QueryString and referencing anchors in the URL

QueryString and referencing anchors in the URL

am 02.06.2007 00:53:59 von bradeck

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?

Re: QueryString and referencing anchors in the URL

am 02.06.2007 09:52:35 von John Blessing

wrote in message
news:1180738439.226811.278160@a26g2000pre.googlegroups.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

Re: QueryString and referencing anchors in the URL

am 04.06.2007 09:15:08 von Adrienne Boswell

Gazing into my crystal ball I observed bradeck@gmail.com writing in
news:1180738439.226811.278160@a26g2000pre.googlegroups.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

Re: QueryString and referencing anchors in the URL

am 04.06.2007 09:46:06 von exjxw.hannivoort

Adrienne Boswell wrote on 04 jun 2007 in
microsoft.public.inetserver.asp.general:

> Gazing into my crystal ball I observed bradeck@gmail.com writing in
> news:1180738439.226811.278160@a26g2000pre.googlegroups.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,"#","^"))
%>


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

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

<%
theURLStr = request.querystring("myurl")
theURLStr = replace(theURLStr,"^","#"))
%>


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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: QueryString and referencing anchors in the URL

am 04.06.2007 18:15:26 von Dave Anderson

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 identifier. 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.