closing a website

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

I have a masterpage that has a hyperlink in the header titled 'Log Out'. The
intent is to have the user select this and it would end all sessions for all
apps that were open and go back to the log in screen. I was looking at using
the following 2 lines to accomplish this.

Session.Abandon();
Response.Redirect("LogIn.aspx");

But, it seems that these are causing havoc when I go to run the website. By
havoc, I mean the website does not want to load. Either the 2 lines are not
correct or I am putting them in the wrong place.

Is there a better way to close it all down than these 2 lines? If these 2
lines are okay then where are they placed?

Thanks...John
 
Are you putting these in the LinkButton_Click method or the Page_Load?

I could see this causing problems in the Page_Load.

Rob
 
I've tried both ways and it is not working. I noticed that a hyperlink in a
masterpage doesn't show any click event when it is double clicked on.
 
Don't use a hyperlink, use a linkbutton.

JohnE said:
I've tried both ways and it is not working. I noticed that a hyperlink in
a
masterpage doesn't show any click event when it is double clicked on.
 
Use either linkButton to write this code on its click event.
Or use hyperlink to navigate to login.aspx and onload event of login.aspx
write down these two lines
 
I switched over to a linkbutton and got it to go to the LogOut.aspx page. It
didn't want to work until I added an extra slash since the LogOut resides in
a different folder. Oh, in my original post I meant LogOut, not Login.
Looking, typing, and thinking were not synched.

A question I do have is that when the LogOut is used with the 2 lines
posted, I can return back by using the browser's back button. How do I end
it all so if the users do use the back button (and I know some will), there
is nothing to go back to?

Thanks.
.... john
 
Back
Top