SignOut( )

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello

the following is in a user control named header.ascx

I have a label control and link button that only display text if a cookie is present

private void Page_Load(object sender, System.EventArgs e)
if(Request.Cookies["xxxxx_xxxx"] != null

signedInLabel.Text = "welcome " + Request.Cookie["xxxxx_xxxx"].Value
signOutButton.Text = "sign out"



This works fine

The problem that i'm having is this

private void signOutButton_Click(object sender, System.EventArgs e

FormsAuthentication.SignOut()
Response.Redirect("nnnn.aspx")


This removes the authentication ticket and redirects, but i also want the label and button to disappear (which is not happening!) Does this mean the cookie is still present? If so, how do I make it null? If I'm completely in the wrong direction, please put me back on track, and please help me with this problem. yes, i am a newbie
thanks, adam ps. i hope i posted this in the right group!!
 
The ViewState will hold the text values of the label and the button. If you want them to disappear, then when you click the signout button, say

signedInLabel.Visible = false
signOutButton.Visible = false

You can also default the visibility of those controls to false, then when you do your null check for the authentication cookie, if the cookie is not null and is valid, then you set the visibility to true.
 
Back
Top