Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > HTML HREF link in ASP

Reply
Thread Tools

HTML HREF link in ASP

 
 
requeth@gmail.com
Guest
Posts: n/a
 
      08-09-2008
I'm trying to do the following, but when I have the code in for hte
HREF link I get a runtime error. How do I pass the link to the end
user?

<%
Dim a as string
Dim b as string
a = request.browser.browser
b = "IE"
if a <> b then
response.write( "You are using " & a & " to view this page. Please
use
Internet Explorer.")
else


<a href="http://example.com/index.aspx">
<img src="./button.jpg" border="0">
</a>


end if
%>


 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      08-09-2008
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm trying to do the following, but when I have the code in for hte
> HREF link I get a runtime error. How do I pass the link to the end
> user?
>
> <%
> Dim a as string
> Dim b as string
> a = request.browser.browser
> b = "IE"
> if a <> b then
> response.write( "You are using " & a & " to view this page. Please
> use
> Internet Explorer.")
> else
>
>
> <a href="http://example.com/index.aspx">
> <img src="./button.jpg" border="0">
> </a>
>
>
> end if
> %>
>


Your missing a pair of %> <% around the html code.

Note that the best place to get ASP.NET help is m.p.dotnet.framework.aspnet




--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      08-09-2008
"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:eQmezVh%(E-Mail Removed)...
> "Anthony Jones" <(E-Mail Removed)> wrote in message
> news:%23egf3Gh%(E-Mail Removed)...
>
> > Note that the best place to get ASP.NET help is
> > m.p.dotnet.framework.aspnet

>
> It is, but the OP's problem relates to VBScript in classic ASP...
>


Really? Looks like VB.NET to me.


Dim a as string

Above not valid in VBScript is in VB.NET


a = response.browser.browser

ASP Response object doesn't have a browser property. ASP.NET does.


Use of

<% %>

works fine with :-

<compilation defaultLanguage="VB">

in the system.web section of web.config

The only thing wrong with the code was a missing pair of %> <% around the
html bit.


--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      08-09-2008
Gazing into my crystal ball I observed "(E-Mail Removed)"
<(E-Mail Removed)> writing in news:38d2ab05-f778-4542-8e00-092c9ff76297
@x35g2000hsb.googlegroups.com:

> I'm trying to do the following, but when I have the code in for hte
> HREF link I get a runtime error. How do I pass the link to the end
> user?
>
> response.write( "You are using " & a & " to view this page. Please
> use
> Internet Explorer.")


Please do not do browser sniffing. If you write your markup correctly, you
will not have to depend on IE's buggy rendering.

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

 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      08-09-2008
"Adrienne Boswell" <(E-Mail Removed)> wrote in message
news:Xns9AF55093A8E66arbpenyahoocom@69.16.185.247. ..
> Gazing into my crystal ball I observed "(E-Mail Removed)"
> <(E-Mail Removed)> writing in news:38d2ab05-f778-4542-8e00-092c9ff76297
> @x35g2000hsb.googlegroups.com:
>
> > I'm trying to do the following, but when I have the code in for hte
> > HREF link I get a runtime error. How do I pass the link to the end
> > user?
> >
> > response.write( "You are using " & a & " to view this page. Please
> > use
> > Internet Explorer.")

>
> Please do not do browser sniffing. If you write your markup correctly,

you
> will not have to depend on IE's buggy rendering.
>


Do you mean that if you write HTML correctly IE will render it correctly?



--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      08-10-2008
Gazing into my crystal ball I observed "Anthony Jones"
<(E-Mail Removed)> writing in
news:uq#CIrk#(E-Mail Removed):

> "Adrienne Boswell" <(E-Mail Removed)> wrote in message
> news:Xns9AF55093A8E66arbpenyahoocom@69.16.185.247. ..
>> Gazing into my crystal ball I observed "(E-Mail Removed)"
>> <(E-Mail Removed)> writing in
>> news:38d2ab05-f778-4542-8e00-092c9ff76297
>> @x35g2000hsb.googlegroups.com:
>>
>> > I'm trying to do the following, but when I have the code in for hte
>> > HREF link I get a runtime error. How do I pass the link to the end
>> > user?
>> >
>> > response.write( "You are using " & a & " to view this page. Please
>> > use
>> > Internet Explorer.")

>>
>> Please do not do browser sniffing. If you write your markup
>> correctly,

> you
>> will not have to depend on IE's buggy rendering.
>>

>
> Do you mean that if you write HTML correctly IE will render it
> correctly?
>
>
>


When I start designing a page, I test it in conforming browsers first,
Opera and Firefox. Those browsers ususally get it right. Then I fix bugs
for IE.

But, well formed markup and valid CSS makes the process a lot easier.
It's one of the reasons I serve conforming browsers XHTML as application
xml+html and I serve IE HTML as text/html. That way, I know right away if
there's an error in the markup that could foul up rendering down the line.
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      08-10-2008


"Adrienne Boswell" <(E-Mail Removed)> wrote in message
news:Xns9AF674AF38AB4arbpenyahoocom@69.16.185.247. ..
> Gazing into my crystal ball I observed "Anthony Jones"
> <(E-Mail Removed)> writing in
> news:uq#CIrk#(E-Mail Removed):
>
> > "Adrienne Boswell" <(E-Mail Removed)> wrote in message
> > news:Xns9AF55093A8E66arbpenyahoocom@69.16.185.247. ..
> >> Gazing into my crystal ball I observed "(E-Mail Removed)"
> >> <(E-Mail Removed)> writing in
> >> news:38d2ab05-f778-4542-8e00-092c9ff76297
> >> @x35g2000hsb.googlegroups.com:
> >>
> >> > I'm trying to do the following, but when I have the code in for hte
> >> > HREF link I get a runtime error. How do I pass the link to the end
> >> > user?
> >> >
> >> > response.write( "You are using " & a & " to view this page. Please
> >> > use
> >> > Internet Explorer.")
> >>
> >> Please do not do browser sniffing. If you write your markup
> >> correctly,

> > you
> >> will not have to depend on IE's buggy rendering.
> >>

> >
> > Do you mean that if you write HTML correctly IE will render it
> > correctly?
> >
> >
> >

>
> When I start designing a page, I test it in conforming browsers first,
> Opera and Firefox. Those browsers ususally get it right. Then I fix bugs
> for IE.
>
> But, well formed markup and valid CSS makes the process a lot easier.
> It's one of the reasons I serve conforming browsers XHTML as application
> xml+html and I serve IE HTML as text/html. That way, I know right away if
> there's an error in the markup that could foul up rendering down the line.


How do you determine which browser you are serving?

--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      08-11-2008
Gazing into my crystal ball I observed "Anthony Jones"
<(E-Mail Removed)> writing in
news:#9esWdy#(E-Mail Removed):

>
>
> "Adrienne Boswell" <(E-Mail Removed)> wrote in message
> news:Xns9AF674AF38AB4arbpenyahoocom@69.16.185.247. ..
>> Gazing into my crystal ball I observed "Anthony Jones"
>> <(E-Mail Removed)> writing in
>> news:uq#CIrk#(E-Mail Removed):
>>
>> > "Adrienne Boswell" <(E-Mail Removed)> wrote in message
>> > news:Xns9AF55093A8E66arbpenyahoocom@69.16.185.247. ..
>> >> Gazing into my crystal ball I observed "(E-Mail Removed)"
>> >> <(E-Mail Removed)> writing in
>> >> news:38d2ab05-f778-4542-8e00-092c9ff76297
>> >> @x35g2000hsb.googlegroups.com:
>> >>
>> >> > I'm trying to do the following, but when I have the code in for
>> >> > hte HREF link I get a runtime error. How do I pass the link to
>> >> > the end user?
>> >> >
>> >> > response.write( "You are using " & a & " to view this page.
>> >> > Please use
>> >> > Internet Explorer.")
>> >>
>> >> Please do not do browser sniffing. If you write your markup
>> >> correctly,
>> > you
>> >> will not have to depend on IE's buggy rendering.
>> >>
>> >
>> > Do you mean that if you write HTML correctly IE will render it
>> > correctly?
>> >
>> >
>> >

>>
>> When I start designing a page, I test it in conforming browsers
>> first, Opera and Firefox. Those browsers ususally get it right.
>> Then I fix bugs for IE.
>>
>> But, well formed markup and valid CSS makes the process a lot easier.
>> It's one of the reasons I serve conforming browsers XHTML as
>> application xml+html and I serve IE HTML as text/html. That way, I
>> know right away if there's an error in the markup that could foul up
>> rendering down the line.

>
> How do you determine which browser you are serving?
>


I look at the HTTP_ACCEPT string, and I also look at the UA string to
see if it's the W3C validator. If it accepts application xml+html then
I serve it that. IE still gets the XHTML strict doctype, but it gets
tag soup (with croutons). With PHP, I can modify the buffer and remove
the ending slash in elements like IMG so IE and others can get HTML, but
I haven't found a way to do that with ASP classic - if there's a way to
do it, I will be all ears.


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

 
Reply With Quote
 
requeth@gmail.com
Guest
Posts: n/a
 
      08-11-2008
On Aug 9, 1:54*pm, "Mark Rae [MVP]" <(E-Mail Removed)> wrote:
> "Anthony Jones" <(E-Mail Removed)> wrote in message
>
> news:OUwng$h%(E-Mail Removed)...
>
> >>> Note that the best place to get ASP.NET help is
> >>> m.p.dotnet.framework.aspnet

>
> >> It is, but the OP's problem relates to VBScript in classic ASP...

>
> > Really? *Looks like VB.NET to me.

>
> He made exactly the same post under the subject of "HTML Link in ASP
> VBSCRIPT block"
>
> --
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net


That I did mark, and the link I received didnt work for me, so instead
of reposting to aparantly the wrong group I tried posting to the
correct one, which is supposed to be this one.
 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      08-11-2008
"Adrienne Boswell" <(E-Mail Removed)> wrote in message
news:Xns9AF748859F62Aarbpenyahoocom@69.16.185.247. ..
> Gazing into my crystal ball I observed "Anthony Jones"
> <(E-Mail Removed)> writing in
> news:#9esWdy#(E-Mail Removed):
>
> >
> >
> > "Adrienne Boswell" <(E-Mail Removed)> wrote in message
> > news:Xns9AF674AF38AB4arbpenyahoocom@69.16.185.247. ..
> >> Gazing into my crystal ball I observed "Anthony Jones"
> >> <(E-Mail Removed)> writing in
> >> news:uq#CIrk#(E-Mail Removed):
> >>
> >> > "Adrienne Boswell" <(E-Mail Removed)> wrote in message
> >> > news:Xns9AF55093A8E66arbpenyahoocom@69.16.185.247. ..
> >> >> Gazing into my crystal ball I observed "(E-Mail Removed)"
> >> >> <(E-Mail Removed)> writing in
> >> >> news:38d2ab05-f778-4542-8e00-092c9ff76297
> >> >> @x35g2000hsb.googlegroups.com:
> >> >>
> >> >> > I'm trying to do the following, but when I have the code in for
> >> >> > hte HREF link I get a runtime error. How do I pass the link to
> >> >> > the end user?
> >> >> >
> >> >> > response.write( "You are using " & a & " to view this page.
> >> >> > Please use
> >> >> > Internet Explorer.")
> >> >>
> >> >> Please do not do browser sniffing. If you write your markup
> >> >> correctly,
> >> > you
> >> >> will not have to depend on IE's buggy rendering.
> >> >>
> >> >
> >> > Do you mean that if you write HTML correctly IE will render it
> >> > correctly?
> >> >
> >> >
> >> >
> >>
> >> When I start designing a page, I test it in conforming browsers
> >> first, Opera and Firefox. Those browsers ususally get it right.
> >> Then I fix bugs for IE.
> >>
> >> But, well formed markup and valid CSS makes the process a lot easier.
> >> It's one of the reasons I serve conforming browsers XHTML as
> >> application xml+html and I serve IE HTML as text/html. That way, I
> >> know right away if there's an error in the markup that could foul up
> >> rendering down the line.

> >
> > How do you determine which browser you are serving?
> >

>
> I look at the HTTP_ACCEPT string, and I also look at the UA string to
> see if it's the W3C validator. If it accepts application xml+html then
> I serve it that. IE still gets the XHTML strict doctype, but it gets
> tag soup (with croutons).


Tag soup? Don't you just send the XHTML but leave the content type as
text/html?

I'm still not sure how you are differentiating IE from other browsers with
this or how by generating 'correct' HTML you manage to avoid IE messing up
the rendering due to its bugs?

>With PHP, I can modify the buffer and remove
> the ending slash in elements like IMG so IE and others can get HTML, but
> I haven't found a way to do that with ASP classic - if there's a way to
> do it, I will be all ears.
>


I'm not sure I understand why you would want to? I send the xhtml content
as text/html without that sort of mucking about, I've not had any problems
with it.


--
Anthony Jones - MVP ASP/ASP.NET


 
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
BASE HREF and A HREF="#" onclick="..." Vincent van Beveren Javascript 2 07-06-2006 08:33 AM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
onClick method question (this.href and document.location.href) yogesh.bhardwaj@gmail.com Javascript 2 02-03-2005 02:38 PM
difference between location.href and window.location.href? saiho.yuen Javascript 3 09-14-2004 06:51 PM
Problem: Setting MSIE iframe innerHTML change relative href/src to absolute href/src Soren Vejrum Javascript 4 07-05-2003 01:47 PM



Advertisments