Read current url

I

IranMania

Is there a way that I can read the current url.

I have an asp page currently such as default.asp?x=1&y=2&z=3

Now I want to keep the existing parameters and attach another parameter
to it and resend to default.asp

As the original parameters are dynamic, and may or may not be
generated, the only way is to read the current url and to simply add my
new parameter such as h=5 to the url.

I don't know how to read the current url.

I tried Request.ServerVariables("SCRIPT_NAME") but that didn't include
the parameters. i.e. it just returned the default.asp

Thank you for your help.
 
B

Bullschmidt

CurrentPage = Request.ServerVariables("SCRIPT_NAME")

And to see all the server variables for a Web page try this:
Response.Write "<br>Server:<br>"
For Each varItem in Request.ServerVariables
For I = 1 to Request.ServerVariables(varItem).Count
Response.Write varItem & " = " & Request.ServerVariables(varItem)(I) &
"<br>"
Next ' Next I.
Next ' Next varItem.

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...

<<
I don't know how to read the current url.
 
C

Curt_C [MVP]

IranMania said:
Is there a way that I can read the current url.

I have an asp page currently such as default.asp?x=1&y=2&z=3

Now I want to keep the existing parameters and attach another parameter
to it and resend to default.asp

As the original parameters are dynamic, and may or may not be
generated, the only way is to read the current url and to simply add my
new parameter such as h=5 to the url.

I don't know how to read the current url.

I tried Request.ServerVariables("SCRIPT_NAME") but that didn't include
the parameters. i.e. it just returned the default.asp

Thank you for your help.

Look up the Request.ServerVariables() collection.. lots in there worth
knowing, including the "URL" value
 
I

IranMania

Thank you everyone for the posts. I was thinking I could also use
Request.QueryString and simply append that to
Request.ServerVariables("SCRIP­T_NAME") or
Request.ServerVariables("URL")

Thank you
 
B

Bullschmidt

Perhaps something like this:

<%= Request.ServerVariables("SCRIPT_NAME") %>?<%=
Request.ServerVariables("QUERY_STRING") %>

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...

<<
Thank you everyone for the posts. I was thinking I could also use
Request.QueryString and simply append that to
Request.ServerVariables("SCRIP­T_NAME") or
Request.ServerVariables("URL")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top