Re: Can't get FormsAuthentication.SignOut to work... ??
From: Greg Burns (greg_burns_at_DONT_SPAM_ME_hotmail.com)
Date: 09/19/04
- Next message: Michael Appelmans: "Re: deploying multiple projects to web server?"
- Previous message: Eliyahu Goldin: "Re: Wrap a div tag around viewstate output"
- In reply to: Ed West: "Can't get FormsAuthentication.SignOut to work... ??"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 19 Sep 2004 10:21:25 -0400
When you say they are still signed in, do you mean
User.Identity.IsAuthenticated = true?. Or that they still have session
variables?
FormsAuthentication.SignOut() will not clear session variables...
Just a thought,
Greg
"Ed West" <west@westville.com> wrote in message
news:u4C9UrhnEHA.592@TK2MSFTNGP11.phx.gbl...
> Hello
>
> This SignOut code is not working, people are still logged in after it
> redirects to default.aspx. any ideas? Thanks. This is really annoying,
> I am ready to launch a site and this is one of the few last things I need
> to figure out...
>
>
> public class logout : System.Web.UI.Page {
> private void Page_Load(object sender, System.EventArgs e) {
> FormsAuthentication.SignOut();
> // tried next line too, did not work...
> Response.Cookies.Remove(FormsAuthentication.FormsCookieName);
>
> Response.Redirect ("default.aspx");
> }
> ....
> }
>
> This is how I logged users on:
>
> FormsAuthenticationTicket authTicket = new
> FormsAuthenticationTicket(
> 1, // version
> email.Text, // user name
> DateTime.Now, // creation
> DateTime.Now.AddMinutes(60),// Expiration
> false, // Persistent
> roles.ToString() );
> string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
> HttpCookie authCookie = new HttpCookie(
> FormsAuthentication.FormsCookieName,encryptedTicket);
> Response.Cookies.Add(authCookie);
> // Redirect the user to the originally requested page
> Response.Redirect( FormsAuthentication.GetRedirectUrl(
> email.Text, false ));
>
>
>
>
- Next message: Michael Appelmans: "Re: deploying multiple projects to web server?"
- Previous message: Eliyahu Goldin: "Re: Wrap a div tag around viewstate output"
- In reply to: Ed West: "Can't get FormsAuthentication.SignOut to work... ??"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|