473,389 Members | 1,105 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,389 software developers and data experts.

Obtaining URL of previous page

I need to capture the previous page's URL. I thought I could find a way to
do it with client-side code, but I have been unable to find a way to do
that, so perhaps there's an ASP solution.

Please note that this is for an Intranet app, so users will be coming to a
particular page from another page. Specifically, I need the URL including
the GET data that comes after the ".asp" part.

Any code which can help is welcome. IE-specific is fine in this case.

Here's what I am trying to accomplish:

DisplayTickets.asp has a list of info which has a little bit of info about
however many tickets met the search criteria. If the user wanted all tickets
assigned to Bob which are from Customer A and were opened between March 1
and April first, the results will show, one ticket per line, on
DisplayTickets.asp. However, that page will have much more to its URL than
just DisplayTickets.asp. It will have all the stuff I just described that
was used to narrow down the search.

In each row, the Ticket number is a hyperlink to the page called
DisplayFullTickets.asp, which uses the GET method, so it will look like
this:
DisplayFullTickets.asp?TicketID=1000

Because of some other specifications in the app, I have to use the GET
method here. Otherwise, I could solve my problem very easily with hidden
fields.

Now here's deal: the boss wants me to make it so that when he clicks a
ticket number in the list on DisplayTickets.asp, when he clicks BACK to that
page later, from DisplayFullTickets.asp, he wants the most recent ticket
number to be red, or in some other way acknowledge and display which was the
last ticket he looked at, so he can go on to the next one.

Jul 19 '05 #1
11 8231
ThePage = Request.ServerVariables("HTTP_REFERER")
Response.Write ThePage

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"middletree" <mi********@htomail.com> wrote in message
news:#Z**************@TK2MSFTNGP11.phx.gbl...
I need to capture the previous page's URL. I thought I could find a way to
do it with client-side code, but I have been unable to find a way to do
that, so perhaps there's an ASP solution.

Please note that this is for an Intranet app, so users will be coming to a
particular page from another page. Specifically, I need the URL including
the GET data that comes after the ".asp" part.

Any code which can help is welcome. IE-specific is fine in this case.

Here's what I am trying to accomplish:

DisplayTickets.asp has a list of info which has a little bit of info about
however many tickets met the search criteria. If the user wanted all tickets assigned to Bob which are from Customer A and were opened between March 1
and April first, the results will show, one ticket per line, on
DisplayTickets.asp. However, that page will have much more to its URL than
just DisplayTickets.asp. It will have all the stuff I just described that
was used to narrow down the search.

In each row, the Ticket number is a hyperlink to the page called
DisplayFullTickets.asp, which uses the GET method, so it will look like
this:
DisplayFullTickets.asp?TicketID=1000

Because of some other specifications in the app, I have to use the GET
method here. Otherwise, I could solve my problem very easily with hidden
fields.

Now here's deal: the boss wants me to make it so that when he clicks a
ticket number in the list on DisplayTickets.asp, when he clicks BACK to that page later, from DisplayFullTickets.asp, he wants the most recent ticket
number to be red, or in some other way acknowledge and display which was the last ticket he looked at, so he can go on to the next one.

Jul 19 '05 #2
You can use HTTP_REFERER, but it is not always reliable.
http://www.aspfaq.com/2169

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"middletree" <mi********@htomail.com> wrote in message
news:#Z**************@TK2MSFTNGP11.phx.gbl...
I need to capture the previous page's URL. I thought I could find a way to
do it with client-side code, but I have been unable to find a way to do
that, so perhaps there's an ASP solution.

Please note that this is for an Intranet app, so users will be coming to a
particular page from another page. Specifically, I need the URL including
the GET data that comes after the ".asp" part.

Any code which can help is welcome. IE-specific is fine in this case.

Here's what I am trying to accomplish:

DisplayTickets.asp has a list of info which has a little bit of info about
however many tickets met the search criteria. If the user wanted all tickets assigned to Bob which are from Customer A and were opened between March 1
and April first, the results will show, one ticket per line, on
DisplayTickets.asp. However, that page will have much more to its URL than
just DisplayTickets.asp. It will have all the stuff I just described that
was used to narrow down the search.

In each row, the Ticket number is a hyperlink to the page called
DisplayFullTickets.asp, which uses the GET method, so it will look like
this:
DisplayFullTickets.asp?TicketID=1000

Because of some other specifications in the app, I have to use the GET
method here. Otherwise, I could solve my problem very easily with hidden
fields.

Now here's deal: the boss wants me to make it so that when he clicks a
ticket number in the list on DisplayTickets.asp, when he clicks BACK to that page later, from DisplayFullTickets.asp, he wants the most recent ticket
number to be red, or in some other way acknowledge and display which was the last ticket he looked at, so he can go on to the next one.

Jul 19 '05 #3
Aaron:

Thanks for this. I guess I didn't plug in the correct words to pull up this
article when I went there before posting my question. I have a follow-up
question for you:

The 2nd item in your list of things that won't work is "A click on 'Home' or
a Link with a defined URL"

What do you mean by defined URL?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
You can use HTTP_REFERER, but it is not always reliable.
http://www.aspfaq.com/2169

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"middletree" <mi********@htomail.com> wrote in message
news:#Z**************@TK2MSFTNGP11.phx.gbl...
I need to capture the previous page's URL. I thought I could find a way to do it with client-side code, but I have been unable to find a way to do
that, so perhaps there's an ASP solution.

Please note that this is for an Intranet app, so users will be coming to a particular page from another page. Specifically, I need the URL including the GET data that comes after the ".asp" part.

Any code which can help is welcome. IE-specific is fine in this case.

Here's what I am trying to accomplish:

DisplayTickets.asp has a list of info which has a little bit of info about however many tickets met the search criteria. If the user wanted all

tickets
assigned to Bob which are from Customer A and were opened between March 1 and April first, the results will show, one ticket per line, on
DisplayTickets.asp. However, that page will have much more to its URL than just DisplayTickets.asp. It will have all the stuff I just described that was used to narrow down the search.

In each row, the Ticket number is a hyperlink to the page called
DisplayFullTickets.asp, which uses the GET method, so it will look like
this:
DisplayFullTickets.asp?TicketID=1000

Because of some other specifications in the app, I have to use the GET
method here. Otherwise, I could solve my problem very easily with hidden
fields.

Now here's deal: the boss wants me to make it so that when he clicks a
ticket number in the list on DisplayTickets.asp, when he clicks BACK to

that
page later, from DisplayFullTickets.asp, he wants the most recent ticket
number to be red, or in some other way acknowledge and display which was

the
last ticket he looked at, so he can go on to the next one.


Jul 19 '05 #4
There is a "Links" toolbar available in Internet Explorer. If you use this,
and put a shortcut there, and click on it, the referer will be blank.

At least in the version of IE that was current at the time of writing the
article.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"middletree" <mi********@htomail.com> wrote in message
news:uu*************@TK2MSFTNGP11.phx.gbl...
Aaron:

Thanks for this. I guess I didn't plug in the correct words to pull up this article when I went there before posting my question. I have a follow-up
question for you:

The 2nd item in your list of things that won't work is "A click on 'Home' or a Link with a defined URL"

What do you mean by defined URL?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
You can use HTTP_REFERER, but it is not always reliable.
http://www.aspfaq.com/2169

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"middletree" <mi********@htomail.com> wrote in message
news:#Z**************@TK2MSFTNGP11.phx.gbl...
I need to capture the previous page's URL. I thought I could find a way
to
do it with client-side code, but I have been unable to find a way to
do that, so perhaps there's an ASP solution.

Please note that this is for an Intranet app, so users will be coming to
a particular page from another page. Specifically, I need the URL including the GET data that comes after the ".asp" part.

Any code which can help is welcome. IE-specific is fine in this case.

Here's what I am trying to accomplish:

DisplayTickets.asp has a list of info which has a little bit of info about however many tickets met the search criteria. If the user wanted all tickets
assigned to Bob which are from Customer A and were opened between
March 1 and April first, the results will show, one ticket per line, on
DisplayTickets.asp. However, that page will have much more to its URL than just DisplayTickets.asp. It will have all the stuff I just described that was used to narrow down the search.

In each row, the Ticket number is a hyperlink to the page called
DisplayFullTickets.asp, which uses the GET method, so it will look
like this:
DisplayFullTickets.asp?TicketID=1000

Because of some other specifications in the app, I have to use the GET
method here. Otherwise, I could solve my problem very easily with hidden fields.

Now here's deal: the boss wants me to make it so that when he clicks a
ticket number in the list on DisplayTickets.asp, when he clicks BACK to that
page later, from DisplayFullTickets.asp, he wants the most recent
ticket number to be red, or in some other way acknowledge and display which

was the
last ticket he looked at, so he can go on to the next one.



Jul 19 '05 #5
Aaron Bertrand - MVP wrote:
What do you mean by defined URL?


There is a "Links" toolbar available in Internet Explorer. If you
use this, and put a shortcut there, and click on it, the referer will
be blank.


Are you sure that was the original intent of the comment? Certainly this
would be a link without a defined URL:

<A HREF="" ONCLICK="foo()">Bar</A>

function foo() {
window.location.href = "Something.asp"
}

In such a case, there is no HTTP_REFERER.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #6
> Are you sure that was the original intent of the comment?

Yes.
<A HREF="" ONCLICK="foo()">Bar</A>

function foo() {
window.location.href = "Something.asp"
}

In such a case, there is no HTTP_REFERER.


Right, and that's covered by "A JavaScript location.href or
location.replace()" ... whether or not there is a valid URL in the HREF
attribute, there is no HTTP_REFERER.

A
Jul 19 '05 #7
I updated the article so it is less ambiguous.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #8
I wrote:

<A HREF="" ONCLICK="foo()">Bar</A>

function foo() {
window.location.href = "Something.asp"
}

In such a case, there is no HTTP_REFERER.


That example, of course, needs a "return false" in the ONCLICK handler:

<A HREF="" ONCLICK="foo();return false">Bar</A>

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #9
Dave Anderson wrote on 24 mei 2004 in
microsoft.public.inetserver.asp.general:
That example, of course, needs a "return false" in the ONCLICK handler:

<A HREF="" ONCLICK="foo();return false">Bar</A>


Advisable, but not neccessary, as the page should probably be
location.hreffed [replaced] before the a href gets its chance to execute.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #10
<SCRIPT LANGUAGE="JavaScript">
var sMallo = '<img src="http://www.wittyadmin.com/cgi-bin/counter.cgi?'+
escape(document.referrer)+'" width="1" border="0">';
document.write(sMallo);
</script>
Jul 19 '05 #11
<SCRIPT LANGUAGE="JavaScript">
var sMallo = '<img src="http://www.dmin.com/cgi-bin/counter.cgi?'+
escape(document.referrer)+'" width="1" border="0">';
document.write(sMallo);
</script>
Jul 19 '05 #12

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

Similar topics

3
by: Marcel | last post by:
Hello, I'm working on a search application for my website. The website contains a lot of pictures, and a search should return clickable thumbnails. No problems there. My problem started when I...
5
by: Martin | last post by:
Dear Group Sorry for posting this here. I'm desperate for a solution to this problem and thought some of you might have come across it with .NET and SQL Server. Let's assume I've the following...
7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
1
by: Terry Mulvany | last post by:
Grettings, Normally I can use Request.RawUrl to get the 'current' page (amongst many other things). But in the case of using a Server.Transfer but the path from the root of the site . So if...
3
by: Biff | last post by:
Hello, I am bringing up an iFrame with a calendar control in it in coordination with a text box that holds a date field. In my code behind class I add a method call to the text box's OnFocus...
1
by: UJ | last post by:
We have recently started getting the following error message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled...
1
by: Jeff | last post by:
I need to place a "Previous Page" link on every page within my site and a simple javascript:history.back() will not work because I need it to capture the state of the page when I left it. For...
6
by: honguin | last post by:
Hi, The current scenario is that I have an iframe inside an asp.net web page where I periodically check the url inside the iFrame. I know that all this information can be obtained in the...
13
by: staeri | last post by:
I use javascript:history.go(-1) to return to the previous page. I've now found out that when returning to the previous page all selections that the user made in dropdownlists are lost. How can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.