views:

920

answers:

3

Using this method after the SignOut() call redirects to '...login.aspx?ReturnUrl=%2fmydomainname%2flogout.aspx' so that the user can't log back in again, since a successful login returns to the logout page. The login page is set in webconfig and the app successfully gets that page. Why would a ReturnURL be stuck on the tail of the URL?

+3  A: 

This is how RedirectFromLoginPage works. It appends the current URL to the query string of the login page. This way, the login page can redirect the user back to the place he where.

If you don't want this to happen, you can manually redirect to the login page using Response.Redirect.

Mehrdad Afshari
+1  A: 

Agreed. Here is a bookmark I had for the same problem.

http://forums.asp.net/t/1159904.aspx

theG
A: 

Not sure if this helps, but according to the docs there is also an overloaded FormsAuthentication.RedirectToLoginPage Method which takes a string and "redirects the browser to the login URL with the specified query string".

See http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.redirecttologinpage.aspx

jamesfm