Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page "flashes"

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
I have the following code at the top of pages to ensure someone has logged in. If not, they are redirected to login and then back. It works.

If Session("user_Login") = "" Then
%>
<script language=&quot;Javascript&quot;)>
document.location=(&quot;../login.asp?referer='&quot; + document.URL +&quot;'&quot;)
</script>
<%
End If

However, before it shoots off to the login page, there is a quick flash of the page the person has actually visited.

Since the code above the first on the page, I can't understand why it is getting past it to show the rest of the page.

Any ideas?


Steve Davis
hey.you@hahaha.com.au
 
You shouldn't use client-side script, but instead it should be processed on server-side. Use this code:

If Session(&quot;user_Login&quot;) = &quot;&quot; Then
fname = Request.ServerVariables(&quot;SCRIPT_NAME&quot;)
Response.Redirect(&quot;../login.asp?referrer='&quot;&amp;fname&amp;&quot;'&quot;)
End If
---
---
 
To get the file name correctly you need to do this actually:

sa = Split(Request.Servervariables(&quot;SCRIPT_NAME&quot;),&quot;/&quot;)
s = sa(UBound(sa))

with previous example you get the complete physical path which is not what you actually need. ---
---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top