SignOut( )

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!!
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,200
Latest member
LaraHunley

Latest Threads

Top