Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove returnurl from url?

I want to remove "returnurl=/blabla" from address bar when a user want to access to a login required page. Because I'm trying to redirect the user to a static page after login to do some selections.

How can I do that?

like image 217
Ali Ersöz Avatar asked Sep 15 '10 09:09

Ali Ersöz


People also ask

What is ReturnURL?

A return URL redirects users back to the originating page during a checkout flow.

What is return URL in asp net?

You can use this method when you want to perform the redirect in your application code instead of using the RedirectFromLoginPage method. The GetRedirectUrl method returns the URL specified in the query string using the ReturnURL variable name.


1 Answers

This is the nature of Forms Authentication. (which im guessing you're using).

That is, when you access a page which requires authentication, ASP.NET will redirect you to the login page, passing in the ReturnUrl as a parameter so you can be returned to the page you came from post-login.

To remove this functionality would break the semantics and design of Forms Authentication itself. (IMO)

My suggestion - if you dont need it, dont use it.

I'm trying to redirect the user to a static page after login to do some selections.

Piece of cake - after you've done your login, instead of doing FormsAuthentication.RedirectFromLoginPage (which uses that very ReturnUrl QueryString parameter), just use FormsAuthentication.SetAuthCookie and redirect wherever you want.

like image 128
RPM1984 Avatar answered Oct 12 '22 22:10

RPM1984