Re: Forms Authentication SignOut does not remove Cookie
From: Ron Cicotte (msnews@summerstreet.net)
Date: 04/22/03
- Previous message: Michael Leung: "RE: UNC file share and NTLM user identity"
- In reply to: Ron Cicotte: "Forms Authentication SignOut does not remove Cookie"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Ron Cicotte" <msnews@summerstreet.net> Date: Tue, 22 Apr 2003 00:29:57 -0400
Problem solved!
I had a path in my web.config that was not the root path "/vci" vs "/" .
Reference docs warn that this can cause the FormsAuthentication to not find
the cookie unless the path is also set correctly when the cookie is created
and paths to pages are case sensitive.
So be Warned! leave the Forms Authentication path setting in Web.config
setting as the default "/" unless you are very sure about what you and your
visitors are doing.
I wasted a day and a half on this.
-ron
"Ron Cicotte" <msnews@summerstreet.net> wrote in message
news:OndOT3GCDHA.2328@TK2MSFTNGP10.phx.gbl...
> I am using forms authentication and it seems to work fine except for the
> FormsAuthentication.Signout(). I have a login page with the following
code
> in the Page_Load function:
>
> private void Page_Load(object sender, System.EventArgs e)
>
> {
>
> //utilities for managing database I/O
>
> Util=new vci_Utilities(this);
>
> if (!IsPostBack)
>
> {
>
> // check forms authentication and set isloggedin = true if the user is
> logged in.
>
> LoginCookies();
>
> // auto logout when coming back to this page after logging in
>
> if(isLoggedIn)
>
> {
>
> FormsAuthentication.SignOut();
>
> isLoggedIn = false;
>
> Session.Abandon();
>
> Response.Redirect("Login.aspx",true);
>
> }
>
> Login_Show();
>
> }
>
> else
>
> {
>
> uid = Int32.Parse(ViewState["uid"].ToString());
>
> isLoggedIn = (bool)ViewState["IsLoggedIn"];
>
> }
>
> }
>
> LoginCookies tests to see if the user is logged in using the
> Request.IsAuthenticated attribute and sets a page var (bool isLoggedIn)
> based on the result. The problem is that the the SignOut() method is not
> removing the authentication cookie as expected. Request.IsAuthenticated
> always returns true. I have a watch on the IsAuthenticated attribute in
my
> VS debugger and it does not change after the Signout() method is invoked.
I
> test it immediately following the repost after redirection and it is still
> true.
>
> What can I do?
>
>
- Previous message: Michael Leung: "RE: UNC file share and NTLM user identity"
- In reply to: Ron Cicotte: "Forms Authentication SignOut does not remove Cookie"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|