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

HTML HREF link in ASP

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
%>
Aug 9 '08 #1
18 4028
<re*****@gmail.comwrote in message
news:38**********************************@x35g2000 hsb.googlegroups.com...
I get a runtime error
As a general rule, when asking for help in a technical newsgroup, saying "I
get a runtime error" is not very helpful if you don't actually tell the
group what the runtime error is...
--
Mark Rae
ASP / ASP.NET MVP
http://www.markrae.net

Aug 9 '08 #2
<re*****@gmail.comwrote in message
news:38**********************************@x35g2000 hsb.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?

<%
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
Aug 9 '08 #3
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
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...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 9 '08 #4
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:eQ***************@TK2MSFTNGP06.phx.gbl...
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
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
Aug 9 '08 #5
Gazing into my crystal ball I observed "re*****@gmail.com"
<re*****@gmail.comwriting 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

Aug 9 '08 #6
"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
Gazing into my crystal ball I observed "re*****@gmail.com"
<re*****@gmail.comwriting 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
Aug 9 '08 #7
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:OU****************@TK2MSFTNGP03.phx.gbl...
>>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 MVP
http://www.markrae.net

Aug 9 '08 #8
Gazing into my crystal ball I observed "Anthony Jones"
<An*@yadayadayada.comwriting in
news:uq**************@TK2MSFTNGP03.phx.gbl:
"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
>Gazing into my crystal ball I observed "re*****@gmail.com"
<re*****@gmail.comwriting 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

Aug 10 '08 #9


"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
Gazing into my crystal ball I observed "Anthony Jones"
<An*@yadayadayada.comwriting in
news:uq**************@TK2MSFTNGP03.phx.gbl:
"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
Gazing into my crystal ball I observed "re*****@gmail.com"
<re*****@gmail.comwriting 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
Aug 10 '08 #10
Gazing into my crystal ball I observed "Anthony Jones"
<An*@yadayadayada.comwriting in
news:#9**************@TK2MSFTNGP03.phx.gbl:
>

"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
>Gazing into my crystal ball I observed "Anthony Jones"
<An*@yadayadayada.comwriting in
news:uq**************@TK2MSFTNGP03.phx.gbl:
"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
Gazing into my crystal ball I observed "re*****@gmail.com"
<re*****@gmail.comwriting 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

Aug 11 '08 #11
On Aug 9, 1:54*pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"Anthony Jones" <A...@yadayadayada.comwrote in message

news:OU****************@TK2MSFTNGP03.phx.gbl...
>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.
Aug 11 '08 #12
"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
Gazing into my crystal ball I observed "Anthony Jones"
<An*@yadayadayada.comwriting in
news:#9**************@TK2MSFTNGP03.phx.gbl:


"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
Gazing into my crystal ball I observed "Anthony Jones"
<An*@yadayadayada.comwriting in
news:uq**************@TK2MSFTNGP03.phx.gbl:

"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.247. ..
Gazing into my crystal ball I observed "re*****@gmail.com"
<re*****@gmail.comwriting 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
Aug 11 '08 #13
<re*****@gmail.comwrote in message
news:9a**********************************@t54g2000 hsg.googlegroups.com...
On Aug 9, 1:54 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
>>>


He made exactly the same post under the subject of "HTML Link in ASP
VBSCRIPT block"
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.
<<<

In that case my comments re the %<% stand but in addition.

This:-

Dim a as string
Dim b as string

Should become:-

Dim a
Dim b

Also the Request object doesn't have a browser property.

You could sniff the User-Agent header:-

a = Request.ServerVariables("HTTP_USER_AGENT")
b = "MSIE"

If Instr(a, b) = -1 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
%>
I hope this if for an intranet project, if I arrived at a public site that
said that I needed to use IE to view its content I probably wouldn't bother
with it.

--
Anthony Jones - MVP ASP/ASP.NET
Aug 11 '08 #14
Anthony Jones wrote:
This:-
>Dim a as string
Dim b as string
....Looks like VB.NET.

And...

Also the Request object doesn't have a browser property.
....except here:

http://msdn.microsoft.com/en-us/libr...roperties.aspx

The OP does not know the difference between ASP and ASP.NET.

--
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.
Aug 11 '08 #15
"Dave Anderson" <NP**********@spammotel.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Anthony Jones wrote:
This:-
Dim a as string
Dim b as string

...Looks like VB.NET.

And...

Also the Request object doesn't have a browser property.

...except here:

http://msdn.microsoft.com/en-us/libr...roperties.aspx
>
The OP does not know the difference between ASP and ASP.NET.


Yes, I orriginaly indicated that in an earlier reply but the OP has since
indicated that VBScript is intended.
--
Anthony Jones - MVP ASP/ASP.NET
Aug 12 '08 #16
Gazing into my crystal ball I observed "Anthony Jones"
<An*@yadayadayada.comwriting in
news:eE**************@TK2MSFTNGP03.phx.gbl:
>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.

If you go over to alt.html, there are plenty of references why it is not
advisable to serve XHTML as text/html - and here's a link with a lot of
information: http://hixie.ch/advocacy/xhtml
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Aug 12 '08 #17
Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn****************************@69.16.185.250. ..
Gazing into my crystal ball I observed "Anthony Jones"
<An*@yadayadayada.comwriting in
news:eE**************@TK2MSFTNGP03.phx.gbl:
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?
Do you have an answer to this question?
>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.

If you go over to alt.html, there are plenty of references why it is not
advisable to serve XHTML as text/html - and here's a link with a lot of
information: http://hixie.ch/advocacy/xhtml

Yes I've read this document before. Some of the more human arguments are
valid (re imagining the content is XHTML when in fact there are often many
practices which break if you actually sent it as xml).

However its also overly purist IMO. Have you actually seen an example of
the /'problem' in the real world?

Even when I use HTML 4.0 strict I'll still send the html as if it were well
formed XML with <br /etc since I work with both XML a great deal I find it
hard to look at HTML that breaks XML rules. I never found an occasion
where HTML that does conform to XML rules to fail to render correctly.
--
Anthony Jones - MVP ASP/ASP.NET
Aug 12 '08 #18
Adrienne Boswell wrote:
If you go over to alt.html, there are plenty of references why it is
not advisable to serve XHTML as text/html - and here's a link with a
lot of information: http://hixie.ch/advocacy/xhtml
Not all of it correct. For example,

browsers treat the string "<br/>" as "<br>" and not "<br>&gt;",
the latter being what HTML4/SGML says they should do.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The HTML 4.01 specification does not state that this *should* render the
same way as SGML. On the contrary, it takes no stand other than to warn that
SHORTTAG constructs for elements are likely unsupported:
http://www.w3.org/TR/html401/appendi...s.html#h-B.3.7

--
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.
Aug 12 '08 #19

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

Similar topics

0
by: SteveJ | last post by:
All, Can someone help me solve the next step. First of all let me say I'm new to php. I pieced the following code together from samples I found on the net and a book I bought called PHP...
1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
26
by: webrod | last post by:
Hi, I have some php pages with a lot of HTML code. I am looking for a HTML validator tool (like TIDY). TIDY is not good enough with PHP tags (it removes a lot of php code). Do you have any...
4
dizyn
by: dizyn | last post by:
Hi here is errors list, i have solved many but these few are not getting solved. Please help me. Line 5 column 113: character data is not allowed here. Line 15 column 6: end tag for "HEAD" which...
3
by: sysguy | last post by:
Hello, I have a table with each <td> has four links in it. There are five cells(i.e <td>) like this and requirement is to align them horizontally on a tabbed panel menu bar. The issue is first...
2
beacon
by: beacon | last post by:
I'm having trouble with a personal web page that I'm designing for work. I'm not well versed in HTML and could use some assistance. Currently, when I open the browser, the table in the head at the...
5
by: smittie31 | last post by:
I am having a problem with a border around me html page. The border does not flow thru the whole html page, it cuts off halfway. --> See http://keithborom.com/marlon-sanders CSS STYLESHEET ...
7
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference....
4
Dököll
by: Dököll | last post by:
Hey Gang! I thought I had a good idea but then I realized JSF doesn't play that... I am trying to mimick what HTML can do in JSF when using target tags to related to inner HTML pages. In...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.