Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

closing a website

0 views
Skip to first unread message

JohnE

unread,
Dec 29, 2009, 3:59:01 PM12/29/09
to
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

Rob Hill

unread,
Dec 29, 2009, 4:03:58 PM12/29/09
to
Are you putting these in the LinkButton_Click method or the Page_Load?
 
I could see this causing problems in the Page_Load.
 
Rob
 

JohnE

unread,
Dec 29, 2009, 5:25:01 PM12/29/09
to
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.

Mark Rae [MVP]

unread,
Dec 29, 2009, 6:13:37 PM12/29/09
to
"JohnE" <Jo...@discussions.microsoft.com> wrote in message
news:28918B42-F340-4375...@microsoft.com...

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

Firstly, there is only one Session object per instance of browser, and there
is only one Application object shared by all instances. Not quite sure what
you mean by "all sessions for all apps", though this may just be a question
of nomenclature...


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

You'll need to describe in more detail exactly what happens or, more
accurately, what doesn't happen... When you're debugging, do you get as far
as the Page_Load event of the login page before the "havoc" starts...?


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Rob Hill

unread,
Dec 29, 2009, 8:48:26 PM12/29/09
to
Don't use a hyperlink, use a linkbutton.

"JohnE" <Jo...@discussions.microsoft.com> wrote in message

news:0B089289-66AD-499B...@microsoft.com...

Abdul Sami

unread,
Dec 30, 2009, 6:45:01 AM12/30/09
to
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
--
Abdul Sami

JohnE

unread,
Dec 30, 2009, 12:47:01 PM12/30/09
to
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

0 new messages