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

QueryString and referencing anchors in the URL

I have a need to pass a url via the address field to a page - i.e.
page.asp?myurl=newpage.asp.

When I get the QueryString object for "myurl" it correctly comes back
with 'newpage.asp'. However, if I pass an anchor name on the url -
e.g. page.asp?myurl=newpage.asp#myanchor - the result is still just
'newpage.asp'.

Is there a way to pass the anchor link into the page and get access to
it?

Jun 1 '07 #1
4 7643
<br*****@gmail.comwrote in message
news:11**********************@a26g2000pre.googlegr oups.com...
>I have a need to pass a url via the address field to a page - i.e.
page.asp?myurl=newpage.asp.

When I get the QueryString object for "myurl" it correctly comes back
with 'newpage.asp'. However, if I pass an anchor name on the url -
e.g. page.asp?myurl=newpage.asp#myanchor - the result is still just
'newpage.asp'.

Is there a way to pass the anchor link into the page and get access to
it?
try Server.URLEncode("newpage.asp#myanchor")

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters
Jun 2 '07 #2
Gazing into my crystal ball I observed br*****@gmail.com writing in
news:11**********************@a26g2000pre.googlegr oups.com:
I have a need to pass a url via the address field to a page - i.e.
page.asp?myurl=newpage.asp.

When I get the QueryString object for "myurl" it correctly comes back
with 'newpage.asp'. However, if I pass an anchor name on the url -
e.g. page.asp?myurl=newpage.asp#myanchor - the result is still just
'newpage.asp'.

Is there a way to pass the anchor link into the page and get access to
it?
I don't think so, because it is client side and ASP does not know about
client side. I know it is not possible in PHP.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Jun 4 '07 #3
Adrienne Boswell wrote on 04 jun 2007 in
microsoft.public.inetserver.asp.general:
Gazing into my crystal ball I observed br*****@gmail.com writing in
news:11**********************@a26g2000pre.googlegr oups.com:
>I have a need to pass a url via the address field to a page - i.e.
page.asp?myurl=newpage.asp.

When I get the QueryString object for "myurl" it correctly comes back
with 'newpage.asp'. However, if I pass an anchor name on the url -
e.g. page.asp?myurl=newpage.asp#myanchor - the result is still just
'newpage.asp'.

Is there a way to pass the anchor link into the page and get access to
it?

I don't think so, because it is client side and ASP does not know about
client side. I know it is not possible in PHP.
You will have to translate it to:

page.asp?myurl=newpage.asp^myanchor

a otherwise the browser will think the
#myanchor
part is ment for
page.asp
and not of
newpage.asp:
============== original.asp ==============

<%
theURLStr = "page.asp?myurl=newpage.asp#myanchor"
theURLStr = replace(theURLStr,"#","^"))
%>
<a href='<%= theURLStr %>'>to page.asp</a>

===========================================

============== page.asp ===================

<%
theURLStr = request.querystring("myurl")
theURLStr = replace(theURLStr,"^","#"))
%>
<a href='<%= theURLStr %>'>to newpage.asp with #myanchor</a>

===========================================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 4 '07 #4
Evertjan. wrote:
You will have to translate it to:

page.asp?myurl=newpage.asp^myanchor

a otherwise the browser will think the
#myanchor
part is ment for
page.asp
and not of
newpage.asp:
If there is an unencoded "#" in the URL that is not part of a character
entity, it IS intended for the client. The browser does not merely *think*
so. It is obeying RFC 1808...

2.4.1. Parsing the Fragment Identifier

If the parse string contains a crosshatch "#" character, then the
substring after the first (left-most) crosshatch "#" and up to the
end of the parse string is the <fragmentidentifier. If the
crosshatch is the last character, or no crosshatch is present, then
the fragment identifier is empty. The matched substring, including
the crosshatch character, is removed from the parse string before
continuing.

Note that the fragment identifier is not considered part of the URL.
However, since it is often attached to the URL, parsers must be able
to recognize and set aside fragment identifiers as part of the
process.
....not to mention RFC 1738:

2.2. URL Character Encoding Issues

All unsafe characters must always be encoded within a URL. For
example, the character "#" must be encoded within URLs even in
systems that do not normally deal with fragment or anchor
identifiers, so that if the URL is copied into another system that
does use them, it will not be necessary to change the URL encoding.

--
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.
Jun 4 '07 #5

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

Similar topics

7
by: Ben Wilson | last post by:
To anyone who can help me, you have my thanks in advance. I am implementing a "301 Moved Permanently" redirect in my website due to a change of our domain names. Unfortunately, I am having a...
2
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
1
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
21
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
5
by: David | last post by:
Hello I need to take some values and place them in a string in the format of a querystring. Lets say I have: string State = "ACT"; string SearchString = "Tax"; int MinRelevance = 50;
6
by: Guadala Harry | last post by:
When passing the '#' character as part of a querstring value, the received Querystring value gets truncated just prior to the '#' character. Exmple: string s = "someColor=#0000FF"; On the...
2
by: Donald | last post by:
I'm having a problem passing QueryString values to other web pages from a frame set. Here's the details of the problem: 1. I have three web forms: WorkObject.ASPX, WorkObject_Header.ASPX and...
3
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a...
2
by: grnjeans922 | last post by:
A little guidance, please.... I'm trying to pass info through the querystring method, across 3 pages. In my first page, it is being sent out using: if regEx.test(strAskedFor) then...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.