[thelist] ASP, HTTP_REFERRER, Session questions

Warden, Matt mwarden at mattwarden.com
Fri Sep 21 06:08:28 CDT 2001


On Sep 21, Beau Hartshorne had something to say about RE: [thelist] ASP,...

>Every page (except the login page) updates a Session object like so:

I hate using sessions when I don't have to, but I guess you're trying to
avoid the messy querystring.

><%
>Session.Contents("URL") = _
>strRequest.ServerVariables("SCRIPT_NAME") + "?" _
>+ Request.ServerVariables("QUERY_STRING")

If you're ysing vbscript, those +'s should be &'s.

>%>
>
>And on the authentication.asp page:
>
><%
>If Session.Contents("URL") = Nothing Then

You'll be wanting to test against "" or Empty, not Nothing. Nothing is a
variable that held a released object. More info here:
http://evolt.org/article/sgd_uses_frontpage/17/346/index.html

>	Response.Redirect("index.asp")
>Else
>	Response.Redirect(Session.Contents("URL")
>End If
>%>

Rather than accessing Session.Contents twice, set that value to a local
variable and then access that variable twice. It's a bit faster.

Also, like aardvark said, if you're on IIS5/ASP3, use Server.Transfer, as
it is a server-side redirect rather than a HTTP 301 (or is it
302?) redirect.



hth,


--
mattwarden
mattwarden.com





More information about the thelist mailing list