By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,897 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

Clearing FormsAuthentication cookie manually

P: n/a
Is there a way to manually clear the FormsAuthentication cookie?

I want to be able to clear the cookie before going to a specific page to
force the logon page to be called before the page.

Thanks,

Tom
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I have a sign out button coded like this:

Private Sub btnSignOut_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSignOut.Click
Session.Clear(HttpContext.Current.Request.Cookies( "ASP.NET_SessionId").Value)
System.Web.Security.FormsAuthentication.SignOut()
HttpContext.Current.User = Nothing
Response.Redirect("~/Login.aspx", True)
End Sub

--
Joe Fallon

"tshad" <ts**********@ftsolutions.com> wrote in message
news:O$****************@TK2MSFTNGP14.phx.gbl...
Is there a way to manually clear the FormsAuthentication cookie?

I want to be able to clear the cookie before going to a specific page to
force the logon page to be called before the page.

Thanks,

Tom

Nov 19 '05 #2

P: n/a
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:O7****************@TK2MSFTNGP10.phx.gbl...
I have a sign out button coded like this:

Private Sub btnSignOut_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSignOut.Click

Session.Clear(HttpContext.Current.Request.Cookies( "ASP.NET_SessionId").Value)
System.Web.Security.FormsAuthentication.SignOut()
HttpContext.Current.User = Nothing
Response.Redirect("~/Login.aspx", True)
End Sub
Looks like what I need.

Thanks,

Tom
--
Joe Fallon

"tshad" <ts**********@ftsolutions.com> wrote in message
news:O$****************@TK2MSFTNGP14.phx.gbl...
Is there a way to manually clear the FormsAuthentication cookie?

I want to be able to clear the cookie before going to a specific page to
force the logon page to be called before the page.

Thanks,

Tom


Nov 19 '05 #3

P: n/a
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:O7****************@TK2MSFTNGP10.phx.gbl...
I have a sign out button coded like this:

Private Sub btnSignOut_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSignOut.Click

Session.Clear(HttpContext.Current.Request.Cookies( "ASP.NET_SessionId").Value)
System.Web.Security.FormsAuthentication.SignOut()
HttpContext.Current.User = Nothing
Response.Redirect("~/Login.aspx", True)
BTW, what does the following do?:

Response.Redirect("~/Login.aspx", True)

What is the tilde for?

Thanks,

Tom. End Sub

--
Joe Fallon

"tshad" <ts**********@ftsolutions.com> wrote in message
news:O$****************@TK2MSFTNGP14.phx.gbl...
Is there a way to manually clear the FormsAuthentication cookie?

I want to be able to clear the cookie before going to a specific page to
force the logon page to be called before the page.

Thanks,

Tom


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.