Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Redirect to a page after Login
Message
From
23/02/2010 14:30:40
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
23/02/2010 12:30:37
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01450504
Message ID:
01450553
Views:
42
>>Hi,
>>
>>I am staring on my first mm .net app. I want the first page to be displayed in my web user interface as the login screen. After the user logs in, I then want to display my main page. Currently I just get a page displayed stating "you are now logged in".
>>
>>I tried adding this code in:
>>
>>
	if (!this.Login())
>>	   this.lblMessage.Text = this.ErrorMessage;
>>            else
>>            {
>>                Response.Redirect("Default.aspx");
>>            }
>>
>>However this does not work. I am aware that if the login form gets displayed by trying to access a secure page, then once logged in that page gets displayed, but I don't like displaying a generic page first which has a "Login" link that links to a secure page.
>
>I think I've got it working as I want it to. I set the start up page as my main page and so the login form gets displayed then the main page.


Hi Frank,

You will probably want your main page to be named Default.aspx for IIS reasons. All you have to do to force the login is set security on that page by overriding the OnInit() method and setting security to true. If you look at the sample I gave you it will have that override in the CustomerMangager page I included. In Aspx Default.aspx will be found by default when someone navigates to your site. If that page has security set, they will be redirected to the login page and after login will be redirected back to default.aspx.
Tim
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform