Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Adding 'http://' to make linkable externaly

Reply
Thread Tools

Adding 'http://' to make linkable externaly

 
 
editor@thecanadianexpat.com
Guest
Posts: n/a
 
      01-19-2006
Newbie question:

I've got an ASP that is accessing a db field populated with web
addresses. The web addresses in the db do not have http:// as a prefix
and as such the resulting pages do not look externaly and are dead
links.

How can I make the following look externally for the correct location:

Response.Write "<a href='" & .Fields("WebAddress") &
"'target='_blank'>" & .Fields("WebAddress") & "</a>"

Can I get the above to automaticly add the http:// to the link?


Thanks in advance for any advice.

Al

 
Reply With Quote
 
 
 
 
McKirahan
Guest
Posts: n/a
 
      01-19-2006
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Newbie question:
>
> I've got an ASP that is accessing a db field populated with web
> addresses. The web addresses in the db do not have http:// as a prefix
> and as such the resulting pages do not look externaly and are dead
> links.
>
> How can I make the following look externally for the correct location:
>
> Response.Write "<a href='" & .Fields("WebAddress") &
> "'target='_blank'>" & .Fields("WebAddress") & "</a>"
>
> Can I get the above to automaticly add the http:// to the link?
>
>
> Thanks in advance for any advice.
>
> Al



Response.Write "<a href='http://" & .Fields("WebAddress") &
"'target='_blank'>" & .Fields("WebAddress") & "</a>"


 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      01-22-2006
Gazing into my crystal ball I observed "McKirahan" <(E-Mail Removed)>
writing in news:(E-Mail Removed):

>> How can I make the following look externally for the correct location:
>>
>> Response.Write "<a href='" & .Fields("WebAddress") &
>> "'target='_blank'>" & .Fields("WebAddress") & "</a>"
>>
>> Can I get the above to automaticly add the http:// to the link?
>>
>>
>> Thanks in advance for any advice.
>>
>> Al

>
>
> Response.Write "<a href='http://" & .Fields("WebAddress") &
> "'target='_blank'>" & .Fields("WebAddress") & "</a>"
>


I would highly suggest not using target=blank, it breaks the user's back
button, and spawns a new window for each link provided. That can create
real havoc on systems with low resources. Additionally, some pop-up
blockers block this as well, creating yet another usabilty issue.

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
 
Reply With Quote
 
Giles
Guest
Posts: n/a
 
      01-22-2006
>> Response.Write "<a href='http://" & .Fields("WebAddress") &
>> "'target='_blank'>" & .Fields("WebAddress") & "</a>"

> "Adrienne Boswell" <(E-Mail Removed)> wrote
> I would highly suggest not using target=blank,> Adrienne Boswell


Additionally, when fixing something broken, you should check it is broken,
or one day you may be fixing things that aren't!
if lcase(left(.Fields("WebAddress") ,7)<>"http://" then
sFix="http://"
else
sFix=""
end if

Response.Write "<a href='" & sFix & .Fields("WebAddress") & ">" &
..Fields("WebAddress") & "</a>"

(Assuming all is http, never ftp etc)


 
Reply With Quote
 
Larry Bud
Guest
Posts: n/a
 
      01-24-2006

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Newbie question:
>
> I've got an ASP that is accessing a db field populated with web
> addresses. The web addresses in the db do not have http:// as a prefix
> and as such the resulting pages do not look externaly and are dead
> links.
>
> How can I make the following look externally for the correct location:
>
> Response.Write "<a href='" & .Fields("WebAddress") &
> "'target='_blank'>" & .Fields("WebAddress") & "</a>"
>
> Can I get the above to automaticly add the http:// to the link?


Your problem doesn't makes any sense, as the browser will assume http
unless the port is specified in the address. The real problem is that
the HTML you're generated is malformed. Looks like there's no space
between ' and target

Response.Write "<a href='" & .Fields("WebAddress") & "'
target='_blank'>" & .Fields("WebAddress") & "</a>"

 
Reply With Quote
 
Larry Bud
Guest
Posts: n/a
 
      01-24-2006

Larry Bud wrote:
> (E-Mail Removed) wrote:
> > Newbie question:
> >
> > I've got an ASP that is accessing a db field populated with web
> > addresses. The web addresses in the db do not have http:// as a prefix
> > and as such the resulting pages do not look externaly and are dead
> > links.
> >
> > How can I make the following look externally for the correct location:
> >
> > Response.Write "<a href='" & .Fields("WebAddress") &
> > "'target='_blank'>" & .Fields("WebAddress") & "</a>"
> >
> > Can I get the above to automaticly add the http:// to the link?

>
> Your problem doesn't makes any sense, as the browser will assume http
> unless the port is specified in the address.


I take back what I said. If you don't specify http://, it will
consider the address just part of the relative path.... Sorry!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to make an entire HTML document linkable? mic123@gmail.com HTML 1 12-03-2007 09:44 PM
Is there a way to make an entire HTML document linkable? mic123@gmail.com HTML 1 12-03-2007 07:47 PM
Using freeze or other application to create linkable dynamic librariesfor c++ applications? Geoff Wedig Python 0 01-20-2006 02:38 PM
How can I assign event handlers externaly? glevik@gmail.com Javascript 1 04-14-2005 11:20 PM
DNS - get MX-record - any linkable tools? Roland Gentner C++ 1 08-03-2003 06:45 PM



Advertisments