Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can't find anything specific. I'm new to ASP.NET, and C# at the same time... so I'm struggling to get it right...

I have url, when i click this url got login page (session use), but my problem this after login how to redirect same url.


thanks in advance !!
Posted

Here is your answer. Refer - Redirect to the previous page after login[^]
Quote:
If you are using the Forms Authentication[^] you can use the ReturnUrl querystring in your login page:
C#
var returnUrl = Request.QueryString["ReturnURL"];
if (string.IsNullOrEmpty(returnUrl)){
   returnUrl = "~/";
}
Response.Redirect(returnUrl);

If you are not using it you should behave as it does: When you redirect the user to the login page add a querystring with the referrer page.
C#
//**Remember to url encode it!**
var returnUrl = Server.UrlEncode(Request.Url.PathAndQuery);
Response.Redirect("~/login.aspx?ReturnURL=" + returnUrl);
 
Share this answer
 
Dude you can try:-

Response.Redirect("Your url.aspx");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900