Why do I have to specify
I've always believed it was there more for the understanding that you can mix ASP.NET tags and HTML Tags, and HTML Tags have the option of either being
runat="server" or not. It doesn't hurt anything to leave the tag in, and it causes a compiler error to take it out. The more things you imply about web language, the less easy it is for a budding programmer to come in and learn it. That's as good a reason as any to be verbose about tag attributes.
This conversation was had on Mike Schinkel's Blog between himself and Talbot Crowell of Microsoft National Services. The relevant information is below (first paragraph paraphrased due to grammatical errors in source):
[...] but the importance of
<runat="server">is more for consistency and extensibility.
If the developer has to mark some tags (viz.
<asp: />) for the ASP.NET Engine to ignore, then there's also the potential issue of namespace collisions among tags and future enhancements. By requiring the
<runat="server">attribute, this is negated.
<runat=client>was required for all client-side tags, the parser would need to parse all tags and strip out the
Currently, If my guess is correct, the parser simply ignores all text (tags or no tags) unless it is a tag with the
runat=serverattribute or a “
<%” prefix or ssi “