ASP.NET, CSS, and Netscape 7.1

N

Nathan Sokalski

I was testing out a page of mine that displays the information from
Page.Request.Browser. It works exactly as I expected in Internet Explorer
and Netscape 4.75 (I didn't expect much in Netscape 4.75, but I got some
stuff). However, Netscape 7.1 gave me some strange stuff, including the
following:

1. It gave the Version as 5.0 rather than 7.1, and the Type as Netscape5
2. ASP.NET did not send any CSS other than the constant part that I entered
manually in the .aspx file

I am assuming that strange thing #1 is simply because it sends a strange
User-Agent string. However, strange thing #2 I have no explanation for,
since even though Netscape 7.1 does not support ALL the CSS I use, it does
support some. I would also like to know what ASP.NET uses to determine
whether or not to send CSS, since Page.Request.Browser does not have a
property that specifies whether the client supports CSS. Any help would be
appreciated.

NOTE: The page I was testing out is located at the following URL:
http://www.nathansokalski.com/Browser.aspx
 
T

Terry Burns

--
Terry Burns
http://TrainingOn.net
Nathan Sokalski said:
I was testing out a page of mine that displays the information from
Page.Request.Browser. It works exactly as I expected in Internet Explorer
and Netscape 4.75 (I didn't expect much in Netscape 4.75, but I got some
stuff). However, Netscape 7.1 gave me some strange stuff, including the
following:
1. It gave the Version as 5.0 rather than 7.1, and the Type as Netscape5
What gave 5.0 ?, can you be more specific ?

2. ASP.NET did not send any CSS other than the constant part that I
entered manually in the .aspx file
Are you saying that the in-line styles did not render to Netscape.?
I am assuming that strange thing #1 is simply because it sends a strange
User-Agent string. However, strange thing #2 I have no explanation for,
since even though Netscape 7.1 does not support ALL the CSS I use, it does
support some. I would also like to know what ASP.NET uses to determine
whether or not to send CSS, since Page.Request.Browser does not have a
property that specifies whether the client supports CSS. Any help would be
appreciated.

You dont specify what version of ASP.NET you are using?

ASP.NET 2003 should have no problems rendering in-line styles to Explorer
or Netscape. as for CSS stylesheets, providing the browser supports it,
you should have no problem. ASP.NET controls know how to render
themselves.
 
N

Nathan Sokalski

1. It gave the Version as 5.0 rather than 7.1, and the Type as Netscape5
What gave 5.0 ?, can you be more specific ?
Page.Request.Browser.Version returned the value "5.0"
Page.Request.Browser.Type returned the value "Netscape5"
Are you saying that the in-line styles did not render to Netscape.?
Yes, that is exactly what I am saying. The output rendered for the Label
Controls was like the following:

Netscape recieved the output like the following:
<span>Browser</span>

Internet Explorer recieved the output like the following:
You dont specify what version of ASP.NET you are using?
I am using ASP.NET 1.1.4322

I don't know whether or not you have Netscape 7.1 on your machine, but if
you do you can try it out and do a view Page Source to see the results for
yourself using the link I included in my original message. Something that I
did find on the web at
http://www.code-magazine.com/articleprint.aspx?quickid=0309091&printmode=true
mentions that this is true for most non-Microsoft browsers, as in the
following paragraphs that I have copied from the page:


The downside to checking the type of the passed HtmlTextWriter is that
virtually all non-Microsoft browsers, including Netscape versions that do
support CSS, pass Html32TextWriter to the Render method. So even a Netscape
6 browser would receive HTML 3.2, even though it supports CSS perfectly. The
only way to get around this is by changing machine.config to add:

tagwriter=System.Web.UI.HtmlTextWriter

to each browser that supports CSS. This is risky though, because this may
not only impact CSS support. So test if your application still works
properly after changing machine.config.



If you know of any better workarounds than modifying the machine.config file
(well, I would probably be forced to add the stuff to my web.config since my
site is on a webhosting service and therefore do not have access to
machine.config), please let me know. I think that there should be a
Page.Request.Browser.CSS property, but since there isn't, I don't know what
else to do. Thanks.
 
A

Andrew Morton

Nathan said:
The only way to get around this is by
changing machine.config to add:
tagwriter=System.Web.UI.HtmlTextWriter

to each browser that supports CSS. This is risky though, because this
may not only impact CSS support. So test if your application still
works properly after changing machine.config.

This may interest you:-
"BrowserCaps update for modern browsers,
http://slingfive.com/pages/code/browserCaps/ "

Andrew
 
N

Nathan Sokalski

Thanks! That is probably the best update I've seen, I want to know why
Microsoft doesn't give updates like that! Thanks again, I really appreciate
it, I will add it to my web.config right away.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top