Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 message box...

Author  Topic 

jhermiz

3564 Posts

Posted - 2004-10-27 : 09:01:09
Err I kind of dont want to use JS for this ... but I think I almost have to...

On some of my pages I do the following:


If Session("Login") Is Nothing Then
'session timed out
Response.Redirect("Login.aspx?ReturnURL=" & Server.UrlEncode(Request.Url.PathAndQuery))
Else
'good session
strLoginUser = Session("Login")
intClientID = Session("ClientID")
End If


That is I redirect them back to the login page if their session expires. So what I want to do is immediately after that display a message (message box) that their session was expired and that was the reason they were redirected. Otherwise they get redirected without knowing...

I guess my other option is to pass something back to login.aspx and do a Request or something and set a message box.

Any ideas ?

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-27 : 09:20:23
YOu can set a session variable called "TimedOut" or something when this happens. Then, on your log-in page, you can check this variable and if it is TRUE you can show some red text or something at the top of the page that indicates why they are there.

- Jeff
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-27 : 10:07:06
quote:
Originally posted by jsmith8858

YOu can set a session variable called "TimedOut" or something when this happens. Then, on your log-in page, you can check this variable and if it is TRUE you can show some red text or something at the top of the page that indicates why they are there.

- Jeff



Good Idea,

Thanks much jeff.

jon
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-10-28 : 02:45:22
...or just add an additional query string parameter to the page, like:

Response.Redirect("Login.aspx?Timeout=Y&ReturnURL=" & Server.UrlEncode(Request.Url.PathAndQuery))

And on that page all you have to do is:

If Request.Querystring("Timeout") = "Y" then
lblTimeout.Visible = True
End If

OS
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-28 : 08:48:38
thats a better idea -- it is best to keep your session variables to a minimum, to save memory. Good call.

- Jeff
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-10-28 : 09:44:18
how bout ViewState?

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -