|
-
Aug 8th, 2011, 03:00 AM
#1
Thread Starter
Fanatic Member
Include Pages
I know in PHP you can do
Code:
require('page1.php');
How can you do this in aspx?
-
Aug 8th, 2011, 03:14 AM
#2
Re: Include Pages
Hello,
There are a couple approaches that you could use.
For instance, you could use ASP.Net User Controls, or you can use ASP.Net Master Pages.
Gary
-
Aug 8th, 2011, 03:29 AM
#3
Thread Starter
Fanatic Member
Re: Include Pages
okay what i have is index.aspx I want to write a script which says if logged in via response.Cookie.... then show a login script otherwise show me the index.php page.
-
Aug 8th, 2011, 03:30 AM
#4
Thread Starter
Fanatic Member
Re: Include Pages
what is the better approach to take?
-
Aug 8th, 2011, 03:48 AM
#5
Re: Include Pages
Are you using the built in ASP.Net Membership Provider?
If so, then the best approach would be to use a LoginView control. You say you want to show index.php, if that is the case, why are you using ASP.Net? I am not saying that you "can't" do this, but mixing two very different technologies is likely to cause you other problems down the line.
Gary
-
Aug 8th, 2011, 02:19 PM
#6
Thread Starter
Fanatic Member
Re: Include Pages
I think you might have missed my question.
I don't want to write this in PHP, I want a ASPX copy of it.
In my index.aspx.vb code I can use VB and check if I cookie exists, if it does not the redirect to login.aspx
On these pages though I want a code to show menu links IF i'm logged in.
So in PHP I would write
Code:
if ($_COOKIE['LoggedIn'] == True){
echo "menui 1";
echo "menu 2";
}
How can I write something in ASP which is the same as the PHP code but in ASP.NET?
-
Aug 9th, 2011, 12:43 AM
#7
Re: Include Pages
Hello,
Nope I don't think I missed the question, but I think you might have missed my response 
Everything that you have described can be achieved out of the box, if you use the built in systems that ASP.Net provides for you. Namely, the ASP.Net Membership, Roles and Profile Providers, along with the built in controls that ship with ASP.Net, such as the LoginView. Now granted, you "could" do all of this work by hand, using similar techniques to those that you used in PHP, but my question would be, why bother?
IMO, it would be much more expedient to use the methods that have been tried and test within ASP.Net.
Gary
-
Aug 9th, 2011, 01:13 AM
#8
Thread Starter
Fanatic Member
Re: Include Pages
Thanks, okay I understand what you are saying and let me explain my position.
I've created a number a "sites" using Web Developer 2008 at working using our internal Intranet - I always get errors with it. How can I test or get the settings of my server so I can build something here at home and know i'm not wasting my time?
Here is my background, I'm a PHP programmer but have basic VB.Net understanding.
I want to build a site (mainly a subsite) on our internal intranet which connects to a database so we can edit, update and delete info.
WHat is this .net membership? what's this loginview? where can i get a quick understanding of all of this???
-
Aug 9th, 2011, 01:18 AM
#9
Re: Include Pages
 Originally Posted by AirlineSim
I've created a number a "sites" using Web Developer 2008 at working using our internal Intranet - I always get errors with it. How can I test or get the settings of my server so I can build something here at home and know i'm not wasting my time?
What sort of errors are you referring to? Can you provide an example? Assuming that you are debugging/building straight out of Visual Studio, there should be no need to configure the server (assuming IIS) at this stage.
 Originally Posted by AirlineSim
WHat is this .net membership? what's this loginview? where can i get a quick understanding of all of this???
The short answer is Google/Bing. Here are a couple links that turned up after a quick search:
Membership
http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx
http://msdn.microsoft.com/en-us/library/ff648345.aspx
LoginView
http://msdn.microsoft.com/en-us/libr...loginview.aspx
http://msdn.microsoft.com/en-us/library/ms178329.aspx
Although the MSDN documentation can appear a bit daunting to start with, it really is the best place to get started.
Gary
-
Aug 9th, 2011, 03:36 AM
#10
Thread Starter
Fanatic Member
Re: Include Pages
I would need to look tomorrow at work but the error around authentication, windows, Password, none etc when i remove it i get the topic 657156 which I created on this forum
http://www.vbforums.com/showthread.php?t=657156
-
Aug 9th, 2011, 06:18 AM
#11
Re: Include Pages
With regard to your other thread, are you able to provide more information, as requested? i.e are you running under IIS? If so, do you have the correct version of the .Net Framework etc installed?
Gary
-
Aug 9th, 2011, 02:54 PM
#12
Thread Starter
Fanatic Member
Re: Include Pages
 Originally Posted by gep13
With regard to your other thread, are you able to provide more information, as requested? i.e are you running under IIS? If so, do you have the correct version of the .Net Framework etc installed?
Gary
I'm not sure, I only have access to some foldes on the server. It's a major corperate server and we have restricted access.
How can I test this?
I tried running it under .NET 2.0 but got the same errors
-
Aug 10th, 2011, 01:09 AM
#13
Re: Include Pages
Rather than continue the discussion about this issue in this thread, lets stick to talking about it in the other thread.
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|