p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_howto thread: Environment variables: SCRIPT_NAME, specifically

Message #1 by "Daniel Walker" <danielw@w...> on Thu, 23 Mar 2000 18:17:18
Content-Type: text/plain; charset="us-ascii"; format=flowed

Try this script to get a gorgeous display of all server variables:

<body bgcolor="#FFFFFF">
Response.Write("<P><B>Server Variables</b><br>")
BlankVars="<P><B>Blank Server Variables</b><br>" & vbcrlf
For Each Key in Request.ServerVariables
         If instr(Key,"_ALL")+instr(key,"ALL_")=0 then
                 If len(tempvalue)=0 then
                         BlankVars=BlankVars & Key & ", "
                         response.write "request.servervariables(" & quote
                         response.write Key & quote & ") "
                         response.write " =<br><B>" & tempvalue & "</b><p>" 
& vbcrlf
                 End If
         end if
response.write mid(BlankVars,1,len(BlankVars)-2)

At 06:17 PM 3/23/00 +0000, you wrote:
>I've just dealt with a guy who was trying to insert the actual text of his
>virtual path in place of the environment variable SCRIPT_NAME in the call
>to the ServerVariables collection, as follows:
>Obviously the text 'BegAsp/DisplayDirectory.asp' is actually the string
>that's returned by a correctly-phrased call, as used on a self-referencing
>page near you - as in, for instance:
>strPhysicalPath = Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))
>After this call,
>strPhysicalPath = "/AspPages/Page.asp"
>So, what he was attempting was a bit off-base.
>I was able to put him right about the syntax. However, it occurred to
>me that I'm really not at all sure what the environment variables
>themselves hold - i.e. what kind of _data_ they store. Pointers of some
>Anybody know? Enlighten me.
>Daniel Walker
>You are currently subscribed to proasp_howto.

  Return to Index