Fog Creek Software
Discussion Board




A standards plug for ASP.Net

I've got a fairly complex site I've developed in ASP.Net. While looking for advice on a popup stopper, I saw the recommendations for Opera, so I figured I'd give it another try (I was a huge Opera fan years ago).

Of course, the first site I had to try was my own, which I've only looked at in IE for the past year.

It renders fine in Opera. Everything works, everything looks as it should. I've found one minor column width glitch in a datagrid, but that's it.

I figure this has got to be a pretty resounding endorsement for ASP.Net...

Philo

Philo
Monday, July 07, 2003

ASP.NET's browser recognition seems to be pretty strong from what I've seen.

The fact that your only problem was with a datagrid is expected. One week with that evil grid from hell and you start to be amazed that it works at all. ;-)

Marc
Monday, July 07, 2003

One problem we found with the rendering was some of the WebControls assumed that if you were using something other than IE they would send back HTML 3.2 rather than HTML 4.0. Say you have a TextBox set to MultiLine and 100% width it doesn't render the style="width:100%" attribute to Mozilla, say (ie, assumes all unrecognised browsers are Netscape 3). To fix it (i.e. get HTML 4.0 to all browsers) put this in your web.config:

<configuration>
  <system.web>
      <browserCaps>
        tagwriter=System.Web.UI.HtmlTextWriter
      </browserCaps>
      ...

Duncan Smart
Monday, July 07, 2003

Hmm,

I still think the ASP.Net solution to this "problem" is a hack, or at least an abstraction designed to leak from the get go.

Is writing proper standards compliant HMTL really that hard?

Walter Rumsby
Monday, July 07, 2003

Writing standards compilant HTML is not hard.

The problem is that no two browsers implement the same standards in the same way. So unless you want to stick to HTML 1.0, no tables, no forms, no script, etc., you've got to make allowances for what the browsers actually do.

Chris Tavares
Monday, July 07, 2003

I think Chris is exaggerating, but only somewhat.

If you want to support both HTML 3.2 (with its typical table style layout) and HTML 4.0 with CSS, and switch depending on the capabilities of the browser, than ASP.NET has some help for you.

If you want to go with HTML 4.0 only (or 3.2 only), it's easy to shove ASP.NET into doing what you want.

Ultimately, the idea behind ASP.NET is that you have controls that render context sensitively. You stop thinking about writing a "page" of HTML, and instead create a page filled with controls. The controls themselves worry about their own HTML. It's akin to the GUI world, moving from pixel manipulation to controls. Sure, sometimes you need to twiddle pixels to get something looking just the way you want, and you're smart to wrap such things into a control for later reuse.

Brad Wilson (dotnetguy.techieswithcats.com)
Monday, July 07, 2003

What percentage of users are using browsers that don't support HTML 4? What percentage of web pages contain elements of HTML 4 that aren't in HTML 3.2?

Pixel/colour/whatever nazi-ism is ultimately futile, someone somewhere will be able to subvert your attempts, but that's cool because that's the way the web is designed.

How do ASP.NET pages appear to things like the W3C HTML validator, search engines or other bots?

I understand what Microsoft is trying to do and I know all the "marketing people..." yadeyadeya, but I think it's a waste of time and effort and a somewhat dangerous one - it entrenches the mediocrity of HTML produced by far too many programmers, web design folk and web design tools by allowing you to not understand what you're doing. It's another evil wizard.

Walter Rumsby
Monday, July 07, 2003

You should try it. It isn't an evil wizard. Hell, it isn't a wizard at all.

All it does is render the page to the capabilities of the client browser. It does this all in the background so that you, the developer, don't have to worry about the fact that IE renders <SomeTag> differently than BrowserX.

As for how it shows up to a HTML validator, it depends. A 3.2 validator will see 3.2 HTML while the 4.0 validator will see 4.0 HTML. What is so wrong with that?

Marc
Monday, July 07, 2003

I'm talking about http://validator.w3.org/ - what happens when you try the validate URL option?

Walter Rumsby
Monday, July 07, 2003

Looks like the answer to my last question is no:

http://www.zeldman.com/daily/0603b.shtml#dotdeux

http://splorp.com/blog/archive/2003_06_01_archive.html#105616763534105021

http://today.icantfocus.com/blog/archives/entries/000204/

Walter Rumsby
Monday, July 07, 2003

At the end of the day, .NET can't get around the basic problem - HTML is crap for delivering complex applications or pages where exact layout is required, because it wasn't designed to do that.

It's stuck between a rock and a hard place ... have things different in each browser, or break standards and try for what works for now.

Neither is a good option, but it has to go one way or the other.

Frankly, I wish client/server hadn't become so unsexy, you don't have to deal with this crap there. HTML is great for content, but horrid for applications.

And the horse you rode in on
Tuesday, July 08, 2003

I'll agree with that. HTML was never designed to be an application platform.

Marc
Tuesday, July 08, 2003

*  Recent Topics

*  Fog Creek Home