473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Url to current page

Hi,
I need to extract the url to the page I'm currently at. For example, if
someone types http://www.mydomain.com/help/help.asp?param=1

I want to extract all this. I've looked att HTTP_REFERER, but it only gives
me the address from the page I came from (and it only exists if I clicked on
a link to get here, not if I wrote it in the address bar).

Any help is appreciated!

Thanks,

Mats-Lennart
Jul 19 '05 #1
4 1315
urLocation = Request.serverVariables("SCRIPT_NAME") & "?" &
Request.Querystring

"Mats-Lennart Hansson" <ap********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,
I need to extract the url to the page I'm currently at. For example, if
someone types http://www.mydomain.com/help/help.asp?param=1

I want to extract all this. I've looked att HTTP_REFERER, but it only gives me the address from the page I came from (and it only exists if I clicked on a link to get here, not if I wrote it in the address bar).

Any help is appreciated!

Thanks,

Mats-Lennart

Jul 19 '05 #2
Request.serverVariables("SCRIPT_NAME")

only returns /help/help.asp. In my case, I also need
http://www.mydomain.com. I did like this,

"http://" & Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("PATH_INFO") & "?" & Request.QueryString

Will this always work, or are there hidden problems? Is there an easier way?

Thanks,
Mats-Lennart

"Dominique" <ni****@webadstudio.com> wrote in message
news:c7**********@ctb-nnrp2.saix.net...
urLocation = Request.serverVariables("SCRIPT_NAME") & "?" &
Request.Querystring

"Mats-Lennart Hansson" <ap********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,
I need to extract the url to the page I'm currently at. For example, if
someone types http://www.mydomain.com/help/help.asp?param=1

I want to extract all this. I've looked att HTTP_REFERER, but it only gives
me the address from the page I came from (and it only exists if I

clicked on
a link to get here, not if I wrote it in the address bar).

Any help is appreciated!

Thanks,

Mats-Lennart


Jul 19 '05 #3
> Will this always work, or are there hidden problems? Is there an easier
way?


Sometimes, users will access the server by a SERVER_NAME that you are not
expecting. For example, they could access it by IP address, or someone
inside your network could access it by network name. Also, someone could
modify their hosts file, and reference your server by whatever name they
want to (e.g. http://this.server.sucks.com/)...

If this is a problem, you could consider storing the domain name section as
a constant (does it REALLY need to be dynamic?).

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #4
"Mats-Lennart Hansson" wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
: Request.serverVariables("SCRIPT_NAME")
:
: only returns /help/help.asp. In my case, I also need
: http://www.mydomain.com. I did like this,
:
: "http://" & Request.ServerVariables("SERVER_NAME") &
: Request.ServerVariables("PATH_INFO") & "?" & Request.QueryString
:
: Will this always work, or are there hidden problems? Is there an easier
way?

Mats-Lennart...

Why do you need the full URL?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Dan | last post by:
When a user clicks on a link in my menu, I want the background color of the link that comes up in the hover to remain on the destination page. My menu looks like this: <div id="adminmenu"> <a...
14
by: Don G | last post by:
Within the menu for my site, I have inserted 'class="current"' within the link for the current page. So the link looks somthing link: <li><a href="index.php" class="current">Home</a></li> The...
4
by: Sandy Bremmer | last post by:
I am wondering if the following can be accomplished with javascript (and if so, if you think javascript is an appropriate solution). I'm afraid my javascript skills lack. I need to build a...
3
by: MarkMurphy | last post by:
In a barebones website with one page, checking HttpContext.Current.Request.UserLanguages.Length in Page_Load of an ASPX page in the VS IDE in codebehind shows a value of 1. Then when I refresh...
15
by: SFX | last post by:
If I have a session ID (string) can I somehow obtain the session object associated to that ID (it exist of course) ? I know this sounds wicked but I have a situation in which I have to make a...
14
by: John Zullo | last post by:
When I look at the HTTPContext.Current at a breakpoint in a Business Object instanntiated by a Page class, the Handler is set to nothing. It only has a value from within the page class itself. I...
3
by: Rhino | last post by:
Yesterday, I reworked the index on my site - http://sfl.london.on.ca - so that they used list markup and I'm quite pleased with them. However, I'm having a problem with one small aspect of the menu...
0
by: davidr | last post by:
Hi, I been stuck on this for a week or more. So please help! I have a menu were a user can click a button and a user control is loaded into the page. A problem occurs when trying to load a...
3
by: laryten | last post by:
Hi, Is there a way to update the same web page instead of getting a new page each time we click the submit button? The simplest thing to do is to delete the current page (or go back to the...
2
by: =?Utf-8?B?YWxiZXJ0b3Nvcmlh?= | last post by:
Hi, I'm using Threads, and when I try to do Server.Transfer, I recieved an error. (child object does not exist...) My Code: Dim t As New Thread(AddressOf Hilo) Private Sub Hilo()...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.