How to redirect to page after successful login?

I am new to web form development, playing with a project created using the ASP.NET web application template in VS 2010. After the user logs in successfully, I want the user to redirect the page I created. How to change the project to redirect the user after logging in? Any samples / textbooks / etc. very much appreciated.

Thanks!

+7
source share
7 answers

To simply redirect to a new page when your user is logged in, use the DestinationPageUrl property of your registration control ... provided that you use the Login control.

If you need to do something more advanced, you can use an event handler to get your users to go to a new page.

+11
source

After you have verified your login:

 Response.Redirect("url"); 
+4
source

I assume that you are using ASP.NET access control. There, the DestinationPageUrl property of this control handles exactly that. If the login was successful, the user is redirected to the URL specified in this property.

+1
source
  <asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Admin/Default.aspx"> </asp:Login> 

Go to Properties and set DestinationPageUrl.

+1
source
 Server.Transfer( *url*) ? 

(HttpServerUtility method)

I know almost nothing about ASP.NET, but from my Java web developer, redirection is bad because it includes a different round-trip network to the browser and back when you really want to continue processing on another page.

And Response.Redirect () does indeed return a 302 response code ("try a different URL") back to the browser. Ugh. XP

Server.Transfer () looks like a java version of Response.Forward ()

0
source

To develop Sharepoint farm solutions

 Page.Response.Redirect("url"); 
0
source

The problem with Response.Redirect () is 302. In some browsers (like Chrome), this will immediately invalidate the new session cookie.

In other words, using this method for redirection leads to the fact that the user is no longer logged in, so you have not reached your goal!

0
source

All Articles