Last post Jan 05, 2015 07:44 PM by Jose Fraga
Sep 11, 2007 03:24 PM|evagaba|LINK
I am at wits end here.
I have a loginstatus control on a master page.
When logged in using Forms Auth, I click LogOut and I get the following page with a bunch of jibberish in the url.
I have set the LogoutAction=RedirectToLoginPage and that did not work.
I also set the event OnLoggingOut to a custom function and it did not get hit.
Another thing I tried was setting the LogoutAction to "Redirect" and set the LogOutPageUrl to my Login Page and that did not fire.
Sep 11, 2007 04:03 PM|tsm|LINK
RedirectToLoginPage redirects the browser to the LoginURL specified in your web.config file.
If you have this set up already can you post more of your code to better troubleshoot this?
Sep 11, 2007 04:10 PM|evagaba|LINK
Yes I am aware of that. It is not working. Here is the section from my web.config
Login.aspx exists. It is my login page.
What other code did you wish to see?
Sep 11, 2007 04:26 PM|tsm|LINK
Can you also include your code for logging out and the url that your are redirected to?
Sep 11, 2007 04:36 PM|evagaba|LINK
I don't have any logout code. It is my understanding that with what I have currently, when the user clicks the logout link on the loginstatus control, they will be taken to the login page. Is this incorrect?
At one point in the loginstatus control, I had LogoutAction=Redirect and LogOutPageUrl=Login.aspx to force it, but that did not work either.
Another thing I tried was writting a custom function for the OnLogingOut event of the control, but it never got hit.
Sep 11, 2007 05:54 PM|tsm|LINK
The way you had it with LogoutAction=Redirect and LogOutPageUrl=Login.aspx looks like it was corretly set up. Have you tried to turning off the protection property to try to verify which page you are being redirected to?
Also to clarify my previous post, if you have the LougoutAction set to RedirectToLoginPage for the LoginStatus control it will the user to the login page defined in the application configuration settings as opposed the RedirectToLoginPage method for the
FormsAuthentication class which will redirect you to the LoginURL specified in the Web.config.
Sep 12, 2007 09:48 AM|evagaba|LINK
Turning protection off changed nothing. I am still stuck here.
Sep 12, 2007 12:10 PM|evagaba|LINK
I seemed to have found the problem..or a solution depending on how you view it.
I had my startup page set to a page in a sub directory and not in the root. I changed the startup page to be a page in the root (which is where login.aspx exists) and now it works as expected. I do not think it should have acted like this though.
Sep 12, 2007 12:18 PM|evagaba|LINK
And the minute I posted it was working....it stopped working. I did not change a thing. Nice.
Sep 13, 2007 05:08 AM|XiaoYong Dai – MSFT|LINK
You can apply absolute path for loginUrl property like this, will it help?
Sep 13, 2007 08:58 AM|evagaba|LINK
Tried this before and tried it again. It did not solve the problem. Clicking logout still takes me to a "Internet Explorer cannot display this page".
Is they ANYTHING else I can try??
Sep 13, 2007 09:20 AM|evagaba|LINK
Ok, I have discovered something but I do not have a solution. Using the above code setting the absolute path "~/page.aspx" where page.aspx is in the web root....
1) If the user is in a subdirectory and they click Logout, "Page cannot be displayed" happens.
2) If I navigate back to a page in the web root and then click the Logout link, everything works as expected. I am logged out and taken to the the Login Page.
Sep 22, 2007 02:26 PM|Stazis|LINK
<forms name=".ASPXFORMSAUTH" loginUrl="~/Anonymous/Login.aspx" />
this works well for me, as you see login page is not at the root
<asp:LoginStatus ID="LoginStatus1" CssClass="LoginStatusLinks" runat="server" meta:resourcekey="LoginStatus"/>
pay attention - very often ppl creates two LoginStatus controls within LoginView control - one for Anonymous template and one for LoggedIn template (as for me it is not very clever but i met a lot of times when ppl complained on LoggedOut Event e.g. does
not fire up.. they just confused between two LoginStatus controls )
Oct 21, 2008 05:02 PMemail@example.com|LINK
set the LogoutAction to "Redirect"
<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Redirect"
Feb 24, 2009 01:19 PM|eliasnunez|LINK
I made a change here to deny unauthenticated users. I'm sure not everyone is using roles like I am.
line that will take the user to the login.aspx page. The commented code is how I had it set up first.
Apr 16, 2014 01:33 PM|echalone|LINK
I ran into a similar problem and thought I'd share my "solution" with you, although I didn't find out what exactly the problem was:
It was pretty simple, I just removed the LoginStatus Tag from within the LoginView Tag and inserted it behind the LoginView Tag (but outside of it)... suddenly it worked again... I recently removed the Anonymous Template and it might have something to do
with that (although readding it didn't help). Now I just added the attribute LoginText="" to the LoginStatus Tag and it won't show me any Login Text either... hope it helps some other desperate soul out their ;)
Jan 05, 2015 07:44 PM|Jose Fraga|LINK
If your redirect page (after logout) have any code in oninit method, try to put your code inside