closing a website

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
 
R

Rob Hill

Are you putting these in the LinkButton_Click method or the Page_Load?

I could see this causing problems in the Page_Load.

Rob
 
J

JohnE

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.
 
R

Rob Hill

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.
 
A

Abdul Sami

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
 
J

JohnE

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
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top