Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

Reload main page on session timeout from frame

How can I reload the main page once a session times out i.e. if they click a link within a frame how do I instruct the main page to reload if the session has expired.
They click a link the page reloads, the session("userid") is checked and if round to be empty then I need to get them to relogin in - I suppose I could just use an intermediary page to show in the frame for them to login again but prefer to redirect back to the index page - as this has some security implications.
0
Gary
Asked:
Gary
  • 3
1 Solution
 
peh803Commented:
Something like this:

1.) check to see if the session("userid") session variable has the correct contents in it
2.) if it has, write JS code to redirect the appropriate frame accordingly.  Something like this:
<%
if len(session("userid")&"")=0 then
  '' session is empty, so assume that it has timed out; now, redirect the "main" frame
%>
  <script type="text/javascript">
    top.frameName.location.href='indexpageurl.asp';
  </script>
<%
end if
%>

Hope this helps.

Regards,
peh803
0
 
peh803Commented:
I said:
"...if it has, write JS code..."

to be clearer:
"...if the session has indeed expired, write JS code..."

HTH,
peh803
0
 
GaryAuthor Commented:
D'oh, so obvious - been a long day!
0
 
peh803Commented:
No problem!  Glad I could help you out.

Regards,
peh803
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now