Redirecting a user to a specific page after logging in

After logging in to "ReturnUrl" in the web application, the last page visited will appear. How to set default.aspx.

I declared the code in the web.config file as follows.

<forms name="FormsAuth" loginUrl="Default.aspx" defaultUrl="Default.aspx" path="/" timeout="200" slidingExpiration="true"> 

But if I close the application on the page /Private/Admin/ReviewIssue.aspx .

When I run the application again on the login page, the URL is as follows

  http://localhost:3042/Test/Default.aspx?ReturnUrl= %2fPrivate%2fAdmin%2fReviewIssue.aspx 

I want the login page only by default .aspx.

+1
source share
1 answer

Assuming this is for an ASP.NET web form project created from a Visual Studio template, go to Register.aspx.cs in the Account folder and edit the code there

  protected void RegisterUser_CreatedUser(object sender, EventArgs e) { FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */); Response.Redirect( "~/default.aspx" ); } 
0
source

All Articles