|
 |
asp_web_howto thread: Displaying hyperlink queries
Message #1 by "Frode" <fstroemm@o...> on Fri, 15 Mar 2002 22:36:56
|
|
Hi!
I want to display a file as a hyperlink on the page, how's the easiest way
to do that when there's different locations used?
For example I tried:
Response.Write "<a href='" & _
Server.URLEncode(rst("FileAdr")) & "'>" & Server.HTMLEncode(rst("Title"))
& "</a>"
But this would add the base server path first.
I would like to be able to insert http://www.myserver.com/~user/file.zip
in my access database and then get this hyperlink displayed on the page.
Thanks.
- Frode
Message #2 by "Ken Schaefer" <ken@a...> on Sun, 17 Mar 2002 21:37:36 +1100
|
|
If you want to link to another site you need to put:
http://www.theothersite.com/
and the beginning of the URL, otherwise the current server's name will be
prepended to the URL.
<%
strURL = "http://www.microsoft.com/"
%>
<a href="<%=strURL%>">Click Here to go to Microsoft's site</a>
NOTE: you only use Server.URLEncode() on the *values* of parameters passed
via the querystring, not on the whole querystring, or URL ie:
somepage.asp?ID=<%=Server.URLEncode(intID)%>&Name=<%=Server.URLEncode(strNam
e)%>
Use Server.URLPathEncode() to encode paths
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Frode" <fstroemm@o...>
Subject: [asp_web_howto] Displaying hyperlink queries
: Hi!
:
: I want to display a file as a hyperlink on the page, how's the easiest way
: to do that when there's different locations used?
:
: For example I tried:
:
: Response.Write "<a href='" & _
: Server.URLEncode(rst("FileAdr")) & "'>" & Server.HTMLEncode(rst("Title"))
: & "</a>"
:
: But this would add the base server path first.
:
: I would like to be able to insert http://www.myserver.com/~user/file.zip
: in my access database and then get this hyperlink displayed on the page.
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |