<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Dan Maharry</title>
    <description>Dan Maharry is a UK-based ASP.NET &amp; C# developer, writer and reviewer. He also makes music &amp; films.</description>
    <link>http://blog.hmobius.com/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 1.6.0.0</generator>
    <language>en-GB</language>
    <blogChannel:blogRoll>http://blog.hmobius.com/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>Dan Maharry</dc:creator>
    <dc:title>Dan Maharry</dc:title>
    <geo:lat>51.979700</geo:lat>
    <geo:long>-1.327600</geo:long>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DansArchive" /><feedburner:info uri="dansarchive" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>51.9797</geo:lat><geo:long>-1.3276</geo:long><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/2.0/</creativeCommons:license><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><item>
      <title>Today's Bookmarks (Mar 11 2010)</title>
      <description>&lt;ul class="delicious"&gt;
&lt;li&gt;
&lt;div class="delicious-link"&gt;&lt;a href="http://www.4guysfromrolla.com/articles/030310-1.aspx"&gt;Improving CSS With .LESS&lt;/a&gt;&lt;/div&gt;
&lt;div class="delicious-extended"&gt;Scott Mitchell investigates how using .LESS (a port of the Ruby LESS library) makes using CSS that bit easier.&lt;/div&gt;
&lt;div class="delicious-tags"&gt;(tags: &lt;a href="http://delicious.com/hmobius/css"&gt;css&lt;/a&gt; &lt;a href="http://delicious.com/hmobius/asp.net"&gt;asp.net&lt;/a&gt; &lt;a href="http://delicious.com/hmobius/c%23"&gt;c#&lt;/a&gt; &lt;a href="http://delicious.com/hmobius/html"&gt;html&lt;/a&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=n6hrenViibk:Iyz0ZpQTNjU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=n6hrenViibk:Iyz0ZpQTNjU:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=n6hrenViibk:Iyz0ZpQTNjU:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=n6hrenViibk:Iyz0ZpQTNjU:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=n6hrenViibk:Iyz0ZpQTNjU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=n6hrenViibk:Iyz0ZpQTNjU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=n6hrenViibk:Iyz0ZpQTNjU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=n6hrenViibk:Iyz0ZpQTNjU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/n6hrenViibk" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/n6hrenViibk/post.aspx</link>
      <author>Dan@Delicious</author>
      <comments>http://blog.hmobius.com/post/2010/03/11/links-for-2010-03-10.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=747de7dc-6183-4275-9958-6094e15851f9</guid>
      <pubDate>Thu, 11 Mar 2010 05:07:00 +0000</pubDate>
      <category>Bookmarks</category>
      <dc:publisher>Dan@Delicious</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=747de7dc-6183-4275-9958-6094e15851f9</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=747de7dc-6183-4275-9958-6094e15851f9</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/03/11/links-for-2010-03-10.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=747de7dc-6183-4275-9958-6094e15851f9</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=747de7dc-6183-4275-9958-6094e15851f9</feedburner:origLink></item>
    <item>
      <title>ASP.NET 4.0 Part 11, Configuring Routing Is Easier</title>
      <description>&lt;p&gt;Welcome to part 11 of &lt;a href="http://blog.hmobius.com/post/2010/02/09/ASPNET-40-Cometh.aspx"&gt;my tour through ASP.NET 4.0&lt;/a&gt;. In this episode, we're going to take a look at how routing for webforms has been made easier to set up in ASP.NET 4.0. This will be followed up in Part 12 with a look at the new route-aware classes, methods and properties in more detail.&lt;/p&gt;
&lt;p&gt;Routing was originally introduced in ASP.NET 3.5 SP1 as part of the foundations to enable the ASP.NET MVC template engine to work. It could also be used against the webforms engine but a certain amount of rolling-your-own-foundation coding was required to enable it properly.&lt;/p&gt;
&lt;p&gt;In ASP.NET 4.0, that initial legwork is no longer necessary as routing for webforms is now supported as standard in System.Web, the majority of the configuration for routing is pre-set in system-wide config files, and some extra goodness has been added into various classes for ease of use as well. All in all, if you haven't had occasion to try routing with webforms before, try it with ASP.NET 4.0. It's really simple.&lt;/p&gt;
&lt;h2&gt;Why?&lt;/h2&gt;
&lt;p&gt;There are a &lt;a title="Scott Mitchell on ASP.NET 4.0 Routing" href="http://www.4guysfromrolla.com/articles/012710-1.aspx" target="_blank"&gt;metric&lt;/a&gt; / &lt;a title="Scott Guthrie on ASP.NET 4.0 Routing" href="http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx" target="_blank"&gt;boatload&lt;/a&gt; / &lt;a title="Scott Galloway on ASP.NET 4.0 Routing" href="http://mostlylucid.net/archive/2009/01/25/asp.net-4.0-webform-routing-quick-rsquon-dirty-version.aspx" target="_blank"&gt;of articles&lt;/a&gt; introducing routing and how it works. In a nutshell, routing, like URL rewriting, is a response to two general criticisms of websites.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;We humans prefer it if a page's URL is readable. For example, &lt;em&gt;http://myforums.info/forum-Music&lt;/em&gt; is easier to read than &lt;em&gt;http://myforums.info/forum.aspx?id=2&lt;/em&gt;. It's easier to remember too &lt;/li&gt;
&lt;li&gt;Search engines prefer human-readable URLs as well. In particular, they like URLs with no querystring parameters at the end. And, the more search engine friendly a site's URLs are, the better indexed they may be by a search engine and the higher they may appear in search rankings. (Obviously, URLs aren't the only thing indexing robots look at when they come to your site - &lt;a title="New Page Directive Attributes" href="http://blog.hmobius.com/post/2010/02/22/ASPNET-40-Part-6-New-Page-Directive-Attributes.aspx" target="_blank"&gt;Descriptions and Keywords&lt;/a&gt; are up there with &lt;a title="Professional SEO with ASP.NET (Amazon UK link)" href="http://www.amazon.co.uk/exec/obidos/ASIN/0470131470/hmobiuscom-21" target="_blank"&gt;a host of other things&lt;/a&gt; too - but they certainly help.) &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So then, the major consequence of routing as far as webforms is concerned are URLs which are more readable for humans and search robots alike with &lt;em&gt;no reduction of information to the page itself&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;How?&lt;/h2&gt;
&lt;p&gt;Routes are initialized as named, regular expressions (using a subset of the standard .NET RegEx syntax) and given an order in which they will be matched against the currently requested URL. For example,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;user-{username} &lt;/li&gt;
&lt;li&gt;forum-{forumname} &lt;/li&gt;
&lt;li&gt;forum-{forumname}/thread-{threadid} &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let's say a request comes to the server for http://myforums.info/forum-Music.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the request is for a page that actually exists on the site, no routing actually occurs and that page is loaded and runs as normal. &lt;/li&gt;
&lt;li&gt;If the page doesn't exist, the requested URL is matched against each initialized route in the order you've specified. In this example, user-{username} doesn't match the requested URL, so the next route is tried. &lt;/li&gt;
&lt;li&gt;When a route matching the requested URL is found, the request is routed to the page that deals with that route. Any named sections of the route are then made available to the handling page within the &lt;em&gt;RouteData&lt;/em&gt; collection. For example, http://myforums.info/forum-Music matches forum-{forumname}, so control for the request would be passed to the page for that route along with a RouteData collection containing one KeyValuePair where forumname is the Key and Music is its value. &lt;/li&gt;
&lt;li&gt;If no route is found to match the incoming request, it is passed to the standard ASP.NET 404 page or a custom page if you've defined one. &lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Routing Is Neither URL Rewriting nor Redirection&lt;/h2&gt;
&lt;p&gt;Hopefully, the above description should differentiate routing from URL rewriting and page redirection. However, just in case it didn't...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Routing is not Page Redirection&lt;/em&gt; &lt;br /&gt;Redirection can only work if the incoming URL is for a page that exist. It works by sending a response to the browser saying that the page has moved with the browser then issuing a second request for the URL it is being redirected to. Routed URLs on the other hand do not necessarily refer to a page that actually exists - they will often seem to refer to directories for example - and are dealt with in one request. Browsers will not issue a second request for the actual page which handles the route. &lt;/li&gt;
&lt;li&gt;&lt;em&gt;Routing is not URL Rewriting        &lt;br /&gt;&lt;/em&gt;URL rewriting occurs very early on in the asp.net request pipeline, literally as request processing is beginning. When the rewritten URL is resolved, IIS then sends it down the pipeline to find a handler to deal with it. It has no control over what handler deals with the request. Routing, on the other hand, occurs further down the pipeline, once the request has been authorised, at which point the routing module dispatches the request to a handler based on which route the request matches and the handler specified by you to deal with the route. (IIS team member Ruslan Yarushev goes into &lt;a title="Article on the differences between URL Rewriting and Routing" href="http://learn.iis.net/page.aspx/496/iis-url-rewriting-and-aspnet-routing/" target="_blank"&gt;much more detail on the differences between the two in this article&lt;/a&gt;.) &lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Setting Up Webforms Routing In ASP.NET 3.5&lt;/h2&gt;
&lt;p&gt;Briefly, here are the steps needed to enable routing for webforms in ASP.NET 3.5.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;All routing classes and namespaces are found in a new DLL, System.Web.Routing.dll to be included as a reference in your website. &lt;/li&gt;
&lt;li&gt;The UrlRoutingModule needs to be added to the list of modules enabled for the site in web.config (&lt;a title="Setting up Webforms Routing v3.5 on MSDN" href="http://msdn.microsoft.com/en-us/library/cc668202.aspx" target="_blank"&gt;as described here in MSDN&lt;/a&gt;) &lt;/li&gt;
&lt;li&gt;A handler class inheriting IRouteHandler needs to be created that understands how to resolve the route into the page or handler that will actually process the request and generate the RouteData collection. Both &lt;a title="Phil Haack on Routing with Webforms" href="http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx" target="_blank"&gt;Phil Haack&lt;/a&gt; and &lt;a title="Chris Cavanagh on setting up webforms routing" href="http://chriscavanagh.wordpress.com/2008/03/11/aspnet-routing-goodbye-url-rewriting/" target="_blank"&gt;Chris Cavanagh&lt;/a&gt; put forward basic implementations of this handler, discussing potential security issues. &lt;/li&gt;
&lt;li&gt;Register the routes for the site in the Application_Start handler of global.asax using your new route handler class. For example, &lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="brush: csharp; auto-links: false;"&gt;protected void Application_Start(object sender, EventArgs e)
{
 RegisterRoutes(RouteTable.Routes);
}

public static void RegisterRoutes(RouteCollection routes)
{
 // Route existing files (default will shortcut routing if physical file exists)
 RouteTable.Routes.RouteExistingFiles = true;

 // Add StopRoutingHandler for .axd and .asmx requests
 routes.Add(new Route("{resource}.axd/{*pathInfo}", 
              new StopRoutingHandler()));
 routes.Add(new Route("{service}.asmx/{*pathInfo}", 
              new StopRoutingHandler()));

 // Add existing routes
 routes.Add("Users", new Route("user-{username}", 
              new WebFormRouteHandler("~/users.aspx", true)));
 routes.Add("Forums", new Route("forum-{forumname}", 
              new WebFormRouteHandler("~/forum.aspx", true)));
 routes.Add("Threads", new Route("forum-{forumname}/thread-{threadid}", 
              new WebFormRouteHandler("~/thread.aspx", true)));

 // Add an unnamed handler for all unknown requests (now created in the PageRoute table)
 //routes.Add(new Route("{value}", 
                new WebFormRouteHandler("~/pages/default.aspx")));
}&lt;/pre&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Write your pages as you would normally using the RouteData collection in place of the Querystring class. You'll need to make RouteData available by passing a RequestContext object to the object that needs access to the RouteData. Again, &lt;a title="Phil Haack's IRouteableObject post" href="http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx" target="_blank"&gt;Phil Haack suggests one way of doing this (via an IRoutableObject interface) here&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;Finally, you have to configure IIS to have ASP.NET deal with requests to your routes, thus passing them on to your RouteHandler classes. If you're using IIS6 and your routes are extension-less (i.e. missing .aspx, .asmx , .ashx etc file extensions in their composition), you'll need to configure wildcard maps on a per-directory level according to where your routes point else you'll end up serving all your static files with ASP.NET as well. Full instructions for this come courtesy of Steve Sanderson (&lt;a href="http://blog.stevensanderson.com/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/" target="_blank"&gt;Part 1&lt;/a&gt;, &lt;a href="http://blog.stevensanderson.com/2008/07/07/overriding-iis6-wildcard-maps-on-individual-directories/" target="_blank"&gt;Part 2&lt;/a&gt;). &lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Setting Up Webforms Routing In ASP.NET 4.0&lt;/h2&gt;
&lt;p&gt;By comparison, the procedure is far more straightforward in ASP.NET 4.0, thanks in large part to Microsoft being able to open up and edit System.Web and the classes inside it. Let's compare&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;System.Web.Routing has been folded into System.Web.dll in .NET 4.0 so there is no need for an additional reference to it in your solution. &lt;/li&gt;
&lt;li&gt;The UrlRoutingModule is also already set up in the machine-wide web.config file which means that it works straight off the bat in IIS 6. For IIS 7 users, however, you'll need to enable it with the following addition to web.config. &lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;configuration&amp;gt;
...
  &amp;lt;system.webServer&amp;gt;
    &amp;lt;modules runAllManagedModulesForAllRequests="true"&amp;gt;
      ...
    &amp;lt;/modules&amp;gt;
  &amp;lt;/system.webServer&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;ol start="3"&gt;
&lt;li&gt;ASP.NET 4.0 includes an implementation of IRouteHandler for you to use - it's called &lt;em&gt;PageRouteHandler&lt;/em&gt;. There's no reason why you can't build your own as before, but it's no longer necessary. &lt;/li&gt;
&lt;li&gt;You still need to register routes for your application but if you're using the built-in PageRouteHandler class, you can use the MapPageRoute helper method to make route registration clearer. &lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="brush: csharp; auto-links: false;"&gt;protected void Application_Start(object sender, EventArgs e)
{
  RegisterRoutes(RouteTable.Routes);
}

public static void RegisterRoutes(RouteCollection routes)
{
  // Route existing files (default will shortcut routing if physical file exists)
  RouteTable.Routes.RouteExistingFiles = true;

  // Add StopRoutingHandler for .axd and .asmx requests
  routes.Add(new Route("{resource}.axd/{*pathInfo}", 
              new StopRoutingHandler()));
  routes.Add(new Route("{service}.asmx/{*pathInfo}", 
              new StopRoutingHandler()));

  // Add existing routes with MapPageRoute helper method
  routes.MapPageRoute("Users", "user-{username}", "~/users.aspx");
  routes.MapPageRoute("Forums", "forum-{forumname}", "~/forum.aspx", true);

  // MapPageRoute is equivalent to adding a Route with the PageRouteHandler like so
  routes.Add("Threads", new Route("forum-{forumname}/thread-{threadid}", 
    new PageRouteHandler("~/thread.aspx", true)));
}&lt;/pre&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Any pages you write now automatically have access to the RouteData collection as a property of the Page class itself, as well as several other route-aware additions we'll review in the next section. &lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="brush: csharp; auto-links: false;"&gt;protected void Page_Load(object sender, EventArgs e)
{
  lblHello.Text = 
    RouteData.Values["username"] == null ?
      "Hello Mr A. Nonymous" : 
      String.Format("Hello {0}", RouteData.Values["username"].ToString());
}&lt;/pre&gt;
&lt;ol start="6"&gt;
&lt;li&gt;Regrettably, while integration into IIS7 Integrated Mode remains quite simple, you still need to configure IIS6 \ IIS7 in Classic mode to associate the routes used in your site with ASP.NET as you did in ASP.NET 3.5. That's a failing of IIS6 rather than ASP.NET. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;As you can see, setting up routing for an ASP.NET 4.0 webforms site is somewhat simpler than for the previous version as Microsoft has taken the opportunity to refactor routing into the core ASP.NET framework. In the next episode, we'll look at several of the new route-aware features for use once in ASP.NET 4.0 sites we've set routing up. Until then, happy coding!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=mcRPwwGWFj4:GCS7yUQ25lQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=mcRPwwGWFj4:GCS7yUQ25lQ:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=mcRPwwGWFj4:GCS7yUQ25lQ:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=mcRPwwGWFj4:GCS7yUQ25lQ:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=mcRPwwGWFj4:GCS7yUQ25lQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=mcRPwwGWFj4:GCS7yUQ25lQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=mcRPwwGWFj4:GCS7yUQ25lQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=mcRPwwGWFj4:GCS7yUQ25lQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/mcRPwwGWFj4" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/mcRPwwGWFj4/post.aspx</link>
      <author>DanM</author>
      <comments>http://blog.hmobius.com/post/2010/03/10/ASPNET-40-Part-11-Configuring-Routing-Is-Easier.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=75b9563b-2f08-4470-ad54-407151c0d770</guid>
      <pubDate>Wed, 10 Mar 2010 01:00:00 +0000</pubDate>
      <category>Geek Stuff</category>
      <category>ASP.NET</category>
      <dc:publisher>DanM</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=75b9563b-2f08-4470-ad54-407151c0d770</pingback:target>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=75b9563b-2f08-4470-ad54-407151c0d770</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/03/10/ASPNET-40-Part-11-Configuring-Routing-Is-Easier.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=75b9563b-2f08-4470-ad54-407151c0d770</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=75b9563b-2f08-4470-ad54-407151c0d770</feedburner:origLink></item>
    <item>
      <title>Filmdash 2010</title>
      <description>&lt;p&gt;This year's &lt;a title="FilmDash home" href="http://filmdash.com/" target="_blank"&gt;Filmdash&lt;/a&gt; event took place last weekend in anticipation of The Oscars. This is the rather manic weekend where teams of budding film makers get given the name and theme of a film to make from scratch in 48 hours and don't usually sleep that much. I've done it before but couldn't make it this year. Happily however, Messrs &lt;a rel="met friend" href="http://www.6itbb.com" target="_blank"&gt;Squier&lt;/a&gt; and &lt;a title="James Eaves current work" rel="friend met" href="http://www.youtube.com/watch?v=0QLjXaXF1Eg" target="_blank"&gt;Eaves&lt;/a&gt; carried on regardless and put together the comic &lt;a title="Silence Is Gordon on Youtube" href="http://www.youtube.com/watch?v=CP8avyfIiCw" target="_blank"&gt;Silence is Gordon&lt;/a&gt;. And a little &lt;a title="The Making of Silence Is Gordon on Youtube" href="http://www.youtube.com/watch?v=0QLjXaXF1Eg" target="_blank"&gt;making of...&lt;/a&gt; video too. The Oscars may still be far away but damn it's fun to make films. Well done lads!&lt;/p&gt;
&lt;div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:48f9a2c3-c91e-42c6-8f42-ec77267dd2d2" class="wlWriterEditableSmartContent" style="margin: 0px auto; width: 425px; display: block; float: none; padding: 0px;"&gt;
&lt;div&gt;
&lt;object width="425" height="355"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/CP8avyfIiCw&amp;amp;hl=en" /&gt;&lt;embed type="application/x-shockwave-flash" width="425" height="355" src="http://www.youtube.com/v/CP8avyfIiCw&amp;amp;hl=en"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/div&gt;
&lt;div style="clear:both;font-size:.8em;"&gt;Silence Is Gordon&lt;/div&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=m6kKcQprvzw:INkEAScK4mw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=m6kKcQprvzw:INkEAScK4mw:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=m6kKcQprvzw:INkEAScK4mw:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=m6kKcQprvzw:INkEAScK4mw:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=m6kKcQprvzw:INkEAScK4mw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=m6kKcQprvzw:INkEAScK4mw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=m6kKcQprvzw:INkEAScK4mw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=m6kKcQprvzw:INkEAScK4mw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/m6kKcQprvzw" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/m6kKcQprvzw/post.aspx</link>
      <author>DanM</author>
      <comments>http://blog.hmobius.com/post/2010/03/08/Filmdash-2010.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=0bf90147-2500-4cbe-a918-c869af5d5517</guid>
      <pubDate>Mon, 08 Mar 2010 23:00:00 +0000</pubDate>
      <category>Making Films</category>
      <dc:publisher>DanM</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=0bf90147-2500-4cbe-a918-c869af5d5517</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=0bf90147-2500-4cbe-a918-c869af5d5517</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/03/08/Filmdash-2010.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=0bf90147-2500-4cbe-a918-c869af5d5517</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=0bf90147-2500-4cbe-a918-c869af5d5517</feedburner:origLink></item>
    <item>
      <title>ASP.NET 4.0 Part 10, A Handful Of Little Things</title>
      <description>&lt;p&gt;Welcome to part 10 of &lt;a href="http://blog.hmobius.com/post/2010/02/09/ASPNET-40-Cometh.aspx"&gt;my tour through ASP.NET 4.0&lt;/a&gt;. In this episode, we’re going to look at a few small but useful additions to the ASP.NET 4.0 webforms template engine before we head out into the wider world of the core framework – routing, caching, sessions and so on.&lt;/p&gt;  &lt;h2&gt;&amp;lt;asp:Chart&amp;gt; Now Built In&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://blog.hmobius.com/image.axd?picture=1_chart.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1_chart" border="0" alt="1_chart" align="left" src="http://blog.hmobius.com/image.axd?picture=1_chart_thumb.png" width="150" height="135" /&gt;&lt;/a&gt; We’ve seen before how Microsoft has folded features from ASP.NET 3.x and other out-of-band releases into the core ASP.NET 4.0 DLLs before. Case in point, the ASP.NET Chart control released in November 2008. This was based on Dundas Chart source code version 5.5 via a Microsoft security, accessibility, and API review. It’s now built into the core which means no additional web.config to get it running and an entry in the Data tab of the standard toolbox set. &lt;/p&gt;  &lt;p&gt;Check out more info on the charting control &lt;a title="ScottGu on the Charting Control" href="http://weblogs.asp.net/scottgu/archive/2010/02/07/built-in-charting-controls-vs-2010-and-net-4-series.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;Three New Redirect Methods&lt;/h2&gt;  &lt;p&gt;The HttpResponse class has been fitted with three new redirect methods, two to work nicely with routing, which we’ll cover later in this series, and the other to play nicer with search engines. &lt;em&gt;Response.RedirectToRoute&lt;/em&gt; and &lt;em&gt;Response.RedirectToRoutePermanent&lt;/em&gt; are the two we'll note in passing for now. As you might suspect, these allow us to redirect users to a page at the end of a route we've defined rather than the page directly. The main difference between the two is that RedirectToRoute sends a &lt;em&gt;HTTP 302 Found&lt;/em&gt; response back to the browser while ResponseToRoutePermanent sends a &lt;em&gt;HTTP 301 Moved Permanently&lt;/em&gt;. To a user, both methods simply redirect their browser to a new page. To a search engine spider, 302 Found implies that the page has moved temporarily, so it will index both the old and new, temporary location. 301 Moved Permanently implies that henceforth the old location is not used and it will only index the new location going forward.&amp;#160; &lt;/p&gt;  &lt;p&gt;The third new redirect method, &lt;em&gt;Response.RedirectPermanent&lt;/em&gt;, also sends a 301 Move Permanently response, but redirects straight to a page rather than a route. It has two overloads like Response.Redirect.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;RedirectPermanent(string url) &lt;/li&gt;    &lt;li&gt;RedirectPermanent(string url, bool endResponse) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The first parameter is simply the URL of the page you wish to redirect to.&lt;/p&gt;  &lt;pre class="brush: csharp; auto-links: false;"&gt;Response.RedirectPermanent(&lt;a href="http://www.danmaharry.com"&gt;http://www.danmaharry.com&lt;/a&gt;);&lt;/pre&gt;

&lt;p&gt;The second parameter lets you specify whether or not ASP.NET should stop processing the page and move straight to processing the Application_EndRequest method in global.asax.cs if you have one. &lt;/p&gt;

&lt;p&gt;Side note: There has always been an issue with Response.Redirect because it calls Response.End internally which can lead to ASP.NET silently throwing ThreadAbortExceptions. &lt;a title="The problem with Response.Redirect" href="http://www.c6software.com/CodeSolutions/dotnet/ThreadAbortException.aspx"&gt;A good thread on this problem can be found here&lt;/a&gt;. The same is likely true of Response.RedirectPermanent, so the upshot is you might want to use these lines of code to avoid the exception being thrown although there are more thorough solutions on offer.&lt;/p&gt;

&lt;pre class="brush: csharp; auto-links: false;"&gt;Response.RedirectPermanent(&amp;quot;http://www.danmaharry.com&amp;quot;, false);
HttpContext.Current.ApplicationInstance.CompleteRequest();&amp;#160; &lt;/pre&gt;

&lt;p&gt;Your mileage may vary with each approach.&lt;/p&gt;

&lt;h2&gt;Inline HTML Encoded Strings&lt;/h2&gt;

&lt;p&gt;Script injection is one of those attack vectors on a website which is easily missed if you're not careful and has the potential for a great deal of grief if you do forget. A first guard against this is to HTMLEncode any user input before being stored in the database or shown on screen. Typically this all done in the code-behind, but the latter can now also be achieved inline using the new &lt;em&gt;&amp;lt;%: message %&amp;gt;&lt;/em&gt; syntax, which will automatically HTML encode the given &lt;em&gt;message&lt;/em&gt; string. For example,&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;p&amp;gt;Unencoded : &amp;lt;script type='text/javascript'&amp;gt;alert('hello');&amp;lt;/script&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Encoded : &amp;lt;%:&amp;quot;&amp;lt;script type='text/javascript'&amp;gt;alert('hello');&amp;lt;/script&amp;gt;&amp;quot; %&amp;gt;&amp;lt;/p&amp;gt; &lt;/pre&gt;

&lt;p&gt;The top line will have the browser running the javascript in the script tags. The bottom line will HTMLEncode the script tags and produce the following code (on one line - the line returns are for clarity).&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;p&amp;gt;Encoded : 
  &amp;amp;lt;script type=&amp;amp;#39;text/javascript&amp;amp;#39;&amp;amp;gt;alert(&amp;amp;#39;hello&amp;amp;#39;);&amp;amp;lt;/script&amp;amp;gt; 
&amp;lt;/p&amp;gt;&lt;/pre&gt;

&lt;p&gt;Take care not to HTMLEncode a string in code-behind and then also inline with this syntax. ASP.NET will simply HTMLEncode it twice - probably not what you need.&lt;/p&gt;

&lt;p&gt;Side note: Two other items of import with respect to ASP.NET security have happened recently. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The &lt;a title="AntiXSS 3.1 Release Announcement" href="http://blogs.msdn.com/sdl/archive/2009/09/23/new-and-improved-antixss-3-1-now-with-sanitization.aspx"&gt;Anti Cross-Site Scripting library v3.1 was released back in November 2009&lt;/a&gt;. Just after that, the Security Tools team announced they are to incorporate it and several other web security tools into a single amalgam, currently known as the &lt;a title="Web Protection Library anouncement" href="http://blogs.msdn.com/securitytools/archive/2009/10/17/web-protection-library-ctp-release-coming-soon.aspx"&gt;Web Protection Library&lt;/a&gt;. The first CTP of WPL is now available on &lt;a title="Download page for WPL CTP1" href="https://connect.microsoft.com/Downloads/DownloadDetails.aspx?SiteID=734&amp;amp;DownloadID=23329"&gt;the MS Connect site&lt;/a&gt; and there's &lt;a title="&amp;quot;Enhanced Web protection Library&amp;quot; video on Channel 9" href="http://channel9.msdn.com/posts/Jossie/Enhanced-Web-Protection-Library/"&gt;a video on Channel 9&lt;/a&gt; where the contents of WPL are explained. &lt;/li&gt;

  &lt;li&gt;Wrox Press has published the rather splendid Beginning ASP.NET Security, which quite thoroughly covers how to write your websites and web services securely and safely. It's a great little book for beginner to intermediate programmers. Author Barry Dorrans (a &lt;a title="Barry announces his new job" href="http://idunno.org/archive/2009/12/20/and-as-a-finale-to-the-year-hellip.aspx"&gt;newly-minted&lt;/a&gt; member of the MS Security Tools team) is also publishing &lt;a title="Errata for Beginning ASP.NET Security" href="http://idunno.org/Tags/Errata/default.aspx"&gt;any errata found in the book&lt;/a&gt; on his blog as well which is handy. You can get it from &lt;a title="Beginning ASP.NET Security on Amazon US" href="http://www.amazon.com/exec/obidos/ASIN/0470743654/hmobiuscom-20" target="_blank"&gt;Amazon US&lt;/a&gt; and &lt;a title="Beginning ASP.NEt Security on Amazon UK" href="http://www.amazon.co.uk/exec/obidos/ASIN/0470743654/hmobiuscom-21" target="_blank"&gt;Amazon UK&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's all for today. In the next episode, we'll take a look at Routing for Webforms. Happy coding!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=UVvPCNiWnTQ:ndDwxgemSMU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=UVvPCNiWnTQ:ndDwxgemSMU:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=UVvPCNiWnTQ:ndDwxgemSMU:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=UVvPCNiWnTQ:ndDwxgemSMU:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=UVvPCNiWnTQ:ndDwxgemSMU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=UVvPCNiWnTQ:ndDwxgemSMU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=UVvPCNiWnTQ:ndDwxgemSMU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=UVvPCNiWnTQ:ndDwxgemSMU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/UVvPCNiWnTQ" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/UVvPCNiWnTQ/post.aspx</link>
      <author>DanM</author>
      <comments>http://blog.hmobius.com/post/2010/03/04/ASPNET-40-Part-10-A-Handful-Of-Little-Things.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=6226df6f-5668-479c-8415-454cfa162621</guid>
      <pubDate>Thu, 04 Mar 2010 22:00:00 +0000</pubDate>
      <category>ASP.NET</category>
      <category>Geek Stuff</category>
      <dc:publisher>DanM</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=6226df6f-5668-479c-8415-454cfa162621</pingback:target>
      <slash:comments>5</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=6226df6f-5668-479c-8415-454cfa162621</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/03/04/ASPNET-40-Part-10-A-Handful-Of-Little-Things.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=6226df6f-5668-479c-8415-454cfa162621</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=6226df6f-5668-479c-8415-454cfa162621</feedburner:origLink></item>
    <item>
      <title>UK Events Of Interest (March\April 2010)</title>
      <description>&lt;p&gt;&lt;a title="Scott&amp;#39;s blog" href="http://weblogs.asp.net/scottgu" rel="met"&gt;Scott Guthrie&lt;/a&gt; is coming to the UK for two days. He’ll be in Glasgow and Birmingham on March 25 and 26 respectively. Registration opened today, so click quickly for &lt;a title="Guathon Glasgow" href="http://developerdeveloperdeveloper.com/guglas/"&gt;Glasgow&lt;/a&gt; and &lt;a title="Guathon Birmingham" href="http://developerdeveloperdeveloper.com/gubrum/"&gt;Birmingham&lt;/a&gt; tickets before they are sold out. Both events are free.&lt;/p&gt;  &lt;p&gt;If you can’t make either of those, Microsoft are running &lt;a href="http://www.microsoft.com/uk/techdays/daydev.aspx"&gt;a week of tech days&lt;/a&gt; in London to mark the launch of Visual Studio 2010 and to promote the new Windows 7 Phone platform. They are all in the &lt;a title="View Map for Vue Cinemas" href="http://maps.google.co.uk/maps?hl=en&amp;amp;ie=UTF8&amp;amp;q=vue+6+cinema+broadway+fulham&amp;amp;fb=1&amp;amp;gl=uk&amp;amp;hq=vue+6+cinema+broadway&amp;amp;hnear=fulham&amp;amp;cid=0,0,3037099974638914753&amp;amp;ei=_JaOS8KcB5ey0gTWhYXyDA&amp;amp;ved=0CAcQnwIwAA&amp;amp;z=16&amp;amp;iwloc=A"&gt;Vue 6 Cinema Broadway in Fulham&lt;/a&gt;. [ &lt;a href="http://www.twitter.com/jesseliberty"&gt;Twitter&lt;/a&gt; tweme: #TechDays ]&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="Register for April 12" href="http://msevents.microsoft.com/cui/eventdetail.aspx?eventid=1032442942&amp;amp;culture=en-gb"&gt;April 12&lt;/a&gt; : Visual Studio 2010 – A Path to Big Ideas (for Heads of Development, Dev Managers and Software Architects&lt;/li&gt;    &lt;li&gt;&lt;a title="Add yourself to the wait list for this event" href="http://msevents.microsoft.com/cui/eventdetail.aspx?eventid=1032442951&amp;amp;culture=en-gb"&gt;April 13&lt;/a&gt; : Getting started with .NET Framework 4 and Visual Studio 2010 (for developers : wait list only)&lt;/li&gt;    &lt;li&gt;&lt;a title="Register for this event" href="http://msevents.microsoft.com/cui/eventdetail.aspx?eventid=1032442953&amp;amp;culture=en-gb"&gt;April 14&lt;/a&gt; : The Essential MIX – Highlights from MIX ‘10 with sessions on ASP.NET 4.0, Silverlight 4 and Azure (for developers)&lt;/li&gt;    &lt;li&gt;&lt;a title="Register for this event" href="http://msevents.microsoft.com/cui/eventdetail.aspx?eventid=1032442957&amp;amp;culture=en-gb"&gt;April 15&lt;/a&gt; : Best of Breed Client Applications on Windows 7 – Windows 7 API, Building Rich Clients with .NET 4 and a bit of Azure (for developers)&lt;/li&gt;    &lt;li&gt;April 16 : Windows Phone – Developing for the Windows 7 Phones Series (for developers : registration not up yet)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you’re a Silverlight fan, then Microsoft’s Silverlight Geek Jesse Liberty is doing &lt;a title="Jesse&amp;#39;s post about the tour" href="http://blogs.silverlight.net/blogs/jesseliberty/archive/2010/04/01/the-united-kingdom-amp-the-republic-of-ireland.aspx"&gt;a 9 day tour of UK&lt;/a&gt; with an extra in Dublin for those in Eire.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;April 12: &lt;a href="http://www.dotnetdevnet.com/"&gt;The .NET Developer Network&lt;/a&gt; in Bristol.&lt;/li&gt;    &lt;li&gt;April 13 and 14:&amp;#160; Microsoft Tech Days, London. &lt;/li&gt;    &lt;li&gt;Tuesday April 13: &lt;a href="http://consultingblogs.emc.com/michelleflynn/archive/2010/02/10/silverlight-user-group-11-video-and-slides.aspx"&gt;Silverlight User Group&lt;/a&gt; /&lt;a href="http://www.dnug.org.uk/"&gt;London .NET User Group&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;Wednesday April 14: &lt;a href="http://www.nxtgenug.net/"&gt;The Next Generation User Group,&lt;/a&gt; Cambridge.&lt;/li&gt;    &lt;li&gt;Thursday April 15: &lt;a href="http://www.blackmarble.com/"&gt;Black Marble User Group&lt;/a&gt;, Leeds&lt;/li&gt;    &lt;li&gt;Friday April 16: &lt;a href="http://www.nebytes.net/"&gt;NEBytes&lt;/a&gt;, Newcastle Upon Tyne&lt;/li&gt;    &lt;li&gt;Monday April 19 &lt;a href="http://scottishdevelopers.com/"&gt;Scottish Developer’s User Group&lt;/a&gt;, Edinburgh      &lt;br /&gt;Tuesday April 20 &lt;a href="http://scottishdevelopers.com/"&gt;Scottish Developer’s User Group&lt;/a&gt;, Glasgow&lt;/li&gt;    &lt;li&gt;Thursday April 21 Belfast: tbc&lt;/li&gt;    &lt;li&gt;Friday April 22 Dublin: tbc&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Overviews of the talks he’ll be giving can be found &lt;a title="Details of Jesse&amp;#39;s UK Tour" href="http://blogs.silverlight.net/blogs/jesseliberty/archive/2010/04/01/the-united-kingdom-amp-the-republic-of-ireland.aspx"&gt;here on his blog&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Of course, if you’re in the US then you’ve also got &lt;a title="MIX homepage" href="http://visitmix.com/"&gt;MIX 10&lt;/a&gt; (March 15-17), &lt;a title="An Event Apart, Seattle, April 5-7" href="http://aneventapart.com/2010/seattle/"&gt;An Event Apart&lt;/a&gt; (April 5-7), the &lt;a title="Information Architecture Summit 2010" href="http://2010.iasummit.org/"&gt;IA Summit 2010&lt;/a&gt; (April 7-11), and &lt;a title="Chirp homepage" href="http://chirp.twitter.com/"&gt;Chirp : The Twitter Dev Conference&lt;/a&gt; (April 14 –15) to attend, so it’s not all bad really, is it?&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=qt8blYXAgz4:rApxEA7rKPI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=qt8blYXAgz4:rApxEA7rKPI:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=qt8blYXAgz4:rApxEA7rKPI:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=qt8blYXAgz4:rApxEA7rKPI:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=qt8blYXAgz4:rApxEA7rKPI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=qt8blYXAgz4:rApxEA7rKPI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=qt8blYXAgz4:rApxEA7rKPI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=qt8blYXAgz4:rApxEA7rKPI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/qt8blYXAgz4" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/qt8blYXAgz4/post.aspx</link>
      <author>obiwan</author>
      <comments>http://blog.hmobius.com/post/2010/03/03/UK-Events-Of-Interest-(March5cApril-2010).aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=440e6815-2a35-4c27-a5dc-7e85ff2cf71c</guid>
      <pubDate>Wed, 03 Mar 2010 17:00:00 +0000</pubDate>
      <category>Attending Events</category>
      <category>Geek Stuff</category>
      <dc:publisher>obiwan</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=440e6815-2a35-4c27-a5dc-7e85ff2cf71c</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=440e6815-2a35-4c27-a5dc-7e85ff2cf71c</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/03/03/UK-Events-Of-Interest-(March5cApril-2010).aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=440e6815-2a35-4c27-a5dc-7e85ff2cf71c</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=440e6815-2a35-4c27-a5dc-7e85ff2cf71c</feedburner:origLink></item>
    <item>
      <title>Today's Bookmarks (March 3 2010)</title>
      <description>&lt;ul class="delicious"&gt;
&lt;li&gt;
&lt;div class="delicious-link"&gt;&lt;a href="http://www.jquery.wisdomplug.com/jquery-plugins/jquery-user-interface-plugins-jquery-plugins/20-impressive-jquery-button-plugins/"&gt;20 Impressive jQuery Button Plugins&lt;/a&gt;&lt;/div&gt;
&lt;div class="delicious-extended"&gt;Nice article about different things you can do with a button and some jQuery&lt;/div&gt;
&lt;div class="delicious-tags"&gt;(tags: &lt;a href="http://delicious.com/hmobius/javascript"&gt;javascript&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/jquery"&gt;jquery&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/tutorial"&gt;tutorial&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/ui"&gt;ui&lt;/a&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div class="delicious-link"&gt;&lt;a href="http://www.stumbleupon.com/su/1P6XnB/www.noupe.com/how-tos/designers-how-to-search-for-hire-and-work-with-a-web-developer.html"&gt;How to Search For, Hire, and Work With a Web Developer&lt;/a&gt;&lt;/div&gt;
&lt;div class="delicious-extended"&gt;Neat article for designers outlining a few simple guidelines for finding a developer to implement your designs&lt;/div&gt;
&lt;div class="delicious-tags"&gt;(tags: &lt;a rel="tags" href="http://delicious.com/hmobius/freelance"&gt;freelance&lt;/a&gt; &lt;a rel="tags" href="http://delicious.com/hmobius/jobs"&gt;jobs&lt;/a&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=044aPLF-4bY:lKx4povgsZ4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=044aPLF-4bY:lKx4povgsZ4:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=044aPLF-4bY:lKx4povgsZ4:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=044aPLF-4bY:lKx4povgsZ4:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=044aPLF-4bY:lKx4povgsZ4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=044aPLF-4bY:lKx4povgsZ4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=044aPLF-4bY:lKx4povgsZ4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=044aPLF-4bY:lKx4povgsZ4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/044aPLF-4bY" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/044aPLF-4bY/post.aspx</link>
      <author>Dan@Delicious</author>
      <comments>http://blog.hmobius.com/post/2010/03/03/Todays-Bookmarks-(March-3-2010).aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=e6941a7f-9141-4e1a-9c9e-99469891fd84</guid>
      <pubDate>Wed, 03 Mar 2010 05:03:00 +0000</pubDate>
      <category>Bookmarks</category>
      <dc:publisher>Dan@Delicious</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=e6941a7f-9141-4e1a-9c9e-99469891fd84</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=e6941a7f-9141-4e1a-9c9e-99469891fd84</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/03/03/Todays-Bookmarks-(March-3-2010).aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=e6941a7f-9141-4e1a-9c9e-99469891fd84</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=e6941a7f-9141-4e1a-9c9e-99469891fd84</feedburner:origLink></item>
    <item>
      <title>ASP.NET, Part 9: Rendering Cleaner HTML</title>
      <description>&lt;p&gt;Welcome to part 9 of &lt;a href="http://blog.hmobius.com/post/2010/02/09/ASPNET-40-Cometh.aspx"&gt;my tour through ASP.NET 4.0&lt;/a&gt;. In this episode, we’ll conclude our look at the ways that ASP.NET has been tweaked in v4.0 to produce cleaner, leaner HTML that we can turn to our purpose without having to deal with some of the inconveniences of previous versions – control IDs and injected HTML we can’t control being two. More control over viewstate being a third.&lt;/p&gt;  &lt;h2&gt;ASP.NET 2.0: Only Technically Standards Compliant…&lt;/h2&gt;  &lt;p&gt;Even in 2005, the idea of producing pure HTML\CSS websites had gained quite a foothold. XHTML had been a W3C Recommendation since 2001 and CSS was evolving and being used more prevalently. Sites like &lt;a title="CSS Zen Garden" href="http://www.csszengarden.com"&gt;CSS Zen Garden&lt;/a&gt; had been championing cross-browser sites and advanced layouts with this approach for a couple of years. All it required was control over the HTML generated by your site and some reasoned application of CSS.&lt;/p&gt;  &lt;p&gt;Regrettably, ASP.NET 1.1 didn’t produce standards-compliant HTML at all, so ASP.NET 2.0 created a new setting in web.config called &lt;a title="MSDN entry on xhtmlConformance" href="http://msdn.microsoft.com/en-gb/library/ms228268(loband).aspx"&gt;xhtmlConformance&lt;/a&gt; that would determine how its server controls were to be rendered as HTML. By default, controls would render markup compatible with the XHTML 1.0 Transitional standard (Transitional). Alternatively, the setting could be changed to have ASP.NET render markup compatible with XHTML 1.0 Strict (Strict) or as v1.1 (Legacy) has rendered it before. Websites upgraded from v1.1 to v2.0 were set to this Legacy mode.&lt;/p&gt;  &lt;p&gt;Unfortunately, &lt;a title="Note from ScottGu about running Legacy rendering against ASP.NET AJAX" href="http://weblogs.asp.net/scottgu/archive/2006/12/10/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax.aspx"&gt;sites running in Legacy mode didn’t work with ASP.NET AJAX&lt;/a&gt; and while Transitional and Strict modes were technically compliant with the XHTML 1.0 standard, they could equally have been described as CSS-intolerant. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Menus were rendered as tables rather than lists (not only harder to work with in CSS, but semantically wrong too)&lt;/li&gt;    &lt;li&gt;Several properties like border=0 or disabled=disabled were mandatorily added to various elements without a way to remove them.&lt;/li&gt;    &lt;li&gt;For templated controls, you had full control over the templates themselves, but not over the outer table that surrounded the templates.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Technically correct, but not a good foundation to build standards compliant sites upon. The introduction of the &lt;a title="ListView on MSDN" href="http://msdn.microsoft.com/en-gb/library/system.web.ui.webcontrols.listview.aspx"&gt;ListView&lt;/a&gt; &amp;amp; &lt;a href="http://msdn.microsoft.com/en-gb/library/system.web.ui.webcontrols.datapager.aspx"&gt;DataPager&lt;/a&gt; controls in ASP.NET 3.5 and the out of band &lt;a title="CSS Firendly Adapters on Codeplex" href="http://www.codeplex.com/cssfriendly"&gt;CSS Control Adapters&lt;/a&gt; release helped somewhat but it’s only because they’ve been able to go into System.Web for .NET 4.0 that Microsoft have been able to make ASP.NET (mostly) CSS-friendly. Indeed, emitting cleaner markup was one of the main goals for ASP.NET 4.0&lt;/p&gt;  &lt;h2&gt;ControlRenderingCompatibilityVersion&lt;/h2&gt;  &lt;p&gt;Like xhtmlConformance in ASP.NET 2.0, a new setting is now available in web.config to control how controls render HTML. It is called &lt;em&gt;ControlRenderingCompatibilityVersion&lt;/em&gt;.&lt;/p&gt;  &lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;
&amp;lt;configuration&amp;gt;
  &amp;lt;system.web&amp;gt;
    &amp;lt;compilation debug=&amp;quot;false&amp;quot; targetFramework=&amp;quot;4.0&amp;quot; /&amp;gt;

    &amp;lt;pages controlRenderingCompatibilityVersion=&amp;quot;3.5&amp;quot; /&amp;gt;

  &amp;lt;/system.web&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;

&lt;p&gt;CRCV, as we’ll call it, takes one of two values. Set it to &lt;em&gt;3.5&lt;/em&gt; (the default for sites upgraded from ASP.NET 3.5) and all server controls will render as they did in ASP.NET 3.5. Set it to &lt;em&gt;4.0&lt;/em&gt; (the default for new web site and web application projects) and the following happens&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;xhtmlConformance is set to &lt;em&gt;Strict&lt;/em&gt;.&lt;/li&gt;

  &lt;li&gt;Menus are rendered as lists rather than tables&lt;/li&gt;

  &lt;li&gt;Extraneous properties like border=0 are removed from the emitted markup. Even the error text on validation controls is no longer set to red.&lt;/li&gt;

  &lt;li&gt;The rendering of the outer table for templated controls can now be controlled with the new &lt;strong&gt;RenderOuterTable&lt;/strong&gt; property.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s look at these changes in detail.&lt;/p&gt;

&lt;h2&gt;Menus&lt;/h2&gt;

&lt;p&gt;Let’s consider a very simple menu control with three items.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:Menu runat=&amp;quot;server&amp;quot; ID=&amp;quot;testMenu&amp;quot;&amp;gt;
  &amp;lt;Items&amp;gt;
    &amp;lt;asp:MenuItem Text=&amp;quot;Menu Item 1&amp;quot; NavigateUrl=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;/asp:MenuItem&amp;gt;
    &amp;lt;asp:MenuItem Text=&amp;quot;Menu Item 2&amp;quot; NavigateUrl=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;/asp:MenuItem&amp;gt;
    &amp;lt;asp:MenuItem Text=&amp;quot;Menu Item 3&amp;quot; NavigateUrl=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;/asp:MenuItem&amp;gt;
  &amp;lt;/Items&amp;gt;
&amp;lt;/asp:Menu&amp;gt;&lt;/pre&gt;

&lt;p&gt;With CRCV set to 3.5, we get three CSS styles for the menu added to the HTML &amp;lt;head&amp;gt;, 53KB of script files added in by two calls to WebResource.axd (21KB for the standard script to handle postbacks, 32KB for a menu-specific script file), and the following HTML for the menu itself.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;body&amp;gt;
  &amp;lt;div&amp;gt;
  &amp;lt;a href=&amp;quot;#testMenu_SkipLink&amp;quot;&amp;gt;
    &amp;lt;img alt=&amp;quot;Skip Navigation Links&amp;quot; width=&amp;quot;0&amp;quot; height=&amp;quot;0&amp;quot; style=&amp;quot;border-width:0px;&amp;quot;
      src=&amp;quot;/CleanHtml/WebResource.axd?d=y4UEb5xFzNnwyKsjxERYdw2&amp;amp;amp;t=634013486901596851&amp;quot; /&amp;gt;
  &amp;lt;/a&amp;gt;
  &amp;lt;table id=&amp;quot;testMenu&amp;quot; class=&amp;quot;testMenu_2&amp;quot; cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;
    &amp;lt;tr onmouseover=&amp;quot;Menu_HoverStatic(this)&amp;quot; onmouseout=&amp;quot;Menu_Unhover(this)&amp;quot; 
      onkeyup=&amp;quot;Menu_Key(this)&amp;quot; id=&amp;quot;testMenun0&amp;quot;&amp;gt;
      &amp;lt;td&amp;gt;
        &amp;lt;table cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;0&amp;quot; width=&amp;quot;100%&amp;quot;&amp;gt;
          &amp;lt;tr&amp;gt;
            &amp;lt;td style=&amp;quot;white-space:nowrap;width:100%;&amp;quot;&amp;gt;
              &amp;lt;a class=&amp;quot;testMenu_1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Menu Item 1&amp;lt;/a&amp;gt;
            &amp;lt;/td&amp;gt;
          &amp;lt;/tr&amp;gt;
        &amp;lt;/table&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;tr onmouseover=&amp;quot;Menu_HoverStatic(this)&amp;quot; onmouseout=&amp;quot;Menu_Unhover(this)&amp;quot; 
      onkeyup=&amp;quot;Menu_Key(this)&amp;quot; id=&amp;quot;testMenun0&amp;quot;&amp;gt;
      &amp;lt;td&amp;gt;
        &amp;lt;table cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;0&amp;quot; width=&amp;quot;100%&amp;quot;&amp;gt;
          &amp;lt;tr&amp;gt;
            &amp;lt;td style=&amp;quot;white-space:nowrap;width:100%;&amp;quot;&amp;gt;
              &amp;lt;a class=&amp;quot;testMenu_1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Menu Item 2&amp;lt;/a&amp;gt;
            &amp;lt;/td&amp;gt;
          &amp;lt;/tr&amp;gt;
        &amp;lt;/table&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;tr onmouseover=&amp;quot;Menu_HoverStatic(this)&amp;quot; onmouseout=&amp;quot;Menu_Unhover(this)&amp;quot; 
      onkeyup=&amp;quot;Menu_Key(this)&amp;quot; id=&amp;quot;testMenun0&amp;quot;&amp;gt;
      &amp;lt;td&amp;gt;
        &amp;lt;table cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;0&amp;quot; width=&amp;quot;100%&amp;quot;&amp;gt;
          &amp;lt;tr&amp;gt;
            &amp;lt;td style=&amp;quot;white-space:nowrap;width:100%;&amp;quot;&amp;gt;
              &amp;lt;a class=&amp;quot;testMenu_1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Menu Item 3&amp;lt;/a&amp;gt;
            &amp;lt;/td&amp;gt;
          &amp;lt;/tr&amp;gt;
        &amp;lt;/table&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/table&amp;gt;
  &amp;lt;a id=&amp;quot;testMenu_SkipLink&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
  &amp;lt;/div&amp;gt; 
  &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; 
    //&amp;lt;![CDATA[
    var testMenu_Data = new Object();
    testMenu_Data.disappearAfter = 500;
    testMenu_Data.horizontalOffset = 0;
    testMenu_Data.verticalOffset = 0;
    //]]&amp;gt;
  &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;&lt;/pre&gt;

&lt;p&gt;With CRCV set to 4.0, we get six CSS styles added to the &amp;lt;head&amp;gt; element, a single 27KB script file downloaded to the browser (a completely refactored version of the menu script) and the following HTML for the menu.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;body&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;a href=&amp;quot;#testMenu_SkipLink&amp;quot;&amp;gt;
    &amp;lt;img alt=&amp;quot;Skip Navigation Links&amp;quot; width=&amp;quot;0&amp;quot; height=&amp;quot;0&amp;quot; style=&amp;quot;border-width:0px;&amp;quot; 
      src=&amp;quot;/CleanHtml/WebResource.axd?d=y4UEb5xFzNnwyKsjxERYdw2&amp;amp;amp;t=634013486901596851&amp;quot; /&amp;gt;
    &amp;lt;/a&amp;gt;
    &amp;lt;div id=&amp;quot;testMenu&amp;quot;&amp;gt;
    &amp;lt;ul class=&amp;quot;level1&amp;quot;&amp;gt;
      &amp;lt;li&amp;gt;&amp;lt;a class=&amp;quot;level1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Menu Item 1&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
      &amp;lt;li&amp;gt;&amp;lt;a class=&amp;quot;level1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Menu Item 2&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
      &amp;lt;li&amp;gt;&amp;lt;a class=&amp;quot;level1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Menu Item 3&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
    &amp;lt;/ul&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;a id=&amp;quot;testMenu_SkipLink&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;script type='text/javascript'&amp;gt;
    new Sys.WebForms.Menu({ 
      element: 'testMenu', 
      disappearAfter: 500, 
      orientation: 'vertical', 
      tabIndex: 0, 
      disabled: false });
  &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;&lt;/pre&gt;

&lt;p&gt;As you can see, not only is the rendered HTML semantically correct, the overall payload is smaller as well. Indeed you can reduce it further by setting the Menu control’s &lt;em&gt;IncludeStyleBlock&lt;/em&gt; property to false. This will remove the six styles added to the &amp;lt;head&amp;gt; element for you to include in your own CSS files. Finally, note that you can set the Menu control’s RenderingMode property to either List, Table or Default. This will override the CRCV setting and render the menu as either List or Table as you’ve set it.&lt;/p&gt;

&lt;h2&gt;Extraneous HTML&lt;/h2&gt;

&lt;p&gt;The Image control is a good example of a control that in ASP.NET 3.5 added a property to the emitted HTML that wasn’t asked for and couldn’t be overridden. Take a very simple declaration&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:Image runat=&amp;quot;server&amp;quot; ID=&amp;quot;imgMorgan&amp;quot; ImageUrl=&amp;quot;~/morgan.jpg&amp;quot; /&amp;gt;&lt;/pre&gt;

&lt;p&gt;With CRCV set to 3.5, ASP.NET sets the image’s border-width to 0px.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;img id=&amp;quot;imgMorgan&amp;quot; src=&amp;quot;morgan.jpg&amp;quot; style=&amp;quot;border-width:0px;&amp;quot; /&amp;gt;&lt;/pre&gt;

&lt;p&gt;With CRCV set to 4.0, there’s no sign of the style property at all.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;img id=&amp;quot;imgMorgan&amp;quot; src=&amp;quot;morgan.jpg&amp;quot; /&amp;gt;&lt;/pre&gt;

&lt;p&gt;Other controls, such as Table and GridView are similarly shed of their extraneous properties.&lt;/p&gt;

&lt;h2&gt;Removing The Outer Table From Some Composite Controls&lt;/h2&gt;

&lt;p&gt;For the most part, ASP.NET controls will render the HTML you want them to, but it looks like some of the more complex, composite controls haven’t been ‘sanitized’ in the same way as more commonly used controls such as the Image or DropDownList. However, it is worth noting that some of these controls now have a new property called RenderOuterTable which does address one particular markup issue. These are&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;FormView&lt;/li&gt;

  &lt;li&gt;Login&lt;/li&gt;

  &lt;li&gt;ChangePassword&lt;/li&gt;

  &lt;li&gt;PasswordRecovery&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Take for example the Login control. &lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:Login runat=&amp;quot;server&amp;quot; ID=&amp;quot;loginTest&amp;quot; /&amp;gt;&lt;/pre&gt;

&lt;p&gt;Whether CRCV is set to 3.5 or 4.0, the default markup is the same.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;0&amp;quot; 
  id=&amp;quot;loginTest&amp;quot; style=&amp;quot;border-collapse:collapse;&amp;quot;&amp;gt;
  &amp;lt;tr&amp;gt;
    &amp;lt;td&amp;gt;
      &amp;lt;table cellpadding=&amp;quot;0&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td align=&amp;quot;center&amp;quot; colspan=&amp;quot;2&amp;quot;&amp;gt;Log In&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td align=&amp;quot;right&amp;quot;&amp;gt;
            &amp;lt;label for=&amp;quot;loginTest_UserName&amp;quot;&amp;gt;User Name:&amp;lt;/label&amp;gt;
          &amp;lt;/td&amp;gt;
          &amp;lt;td&amp;gt;
            &amp;lt;input name=&amp;quot;loginTest$UserName&amp;quot; type=&amp;quot;text&amp;quot; id=&amp;quot;loginTest_UserName&amp;quot; /&amp;gt;
            &amp;lt;span id=&amp;quot;loginTest_UserNameRequired&amp;quot; title=&amp;quot;User Name is required.&amp;quot; 
              style=&amp;quot;color:Red;visibility:hidden;&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td align=&amp;quot;right&amp;quot;&amp;gt;
            &amp;lt;label for=&amp;quot;loginTest_Password&amp;quot;&amp;gt;Password:&amp;lt;/label&amp;gt;
          &amp;lt;/td&amp;gt;
          &amp;lt;td&amp;gt;
            &amp;lt;input name=&amp;quot;loginTest$Password&amp;quot; type=&amp;quot;password&amp;quot; id=&amp;quot;loginTest_Password&amp;quot; /&amp;gt;
            &amp;lt;span id=&amp;quot;loginTest_PasswordRequired&amp;quot; title=&amp;quot;Password is required.&amp;quot; 
              style=&amp;quot;color:Red;visibility:hidden;&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td colspan=&amp;quot;2&amp;quot;&amp;gt;
            &amp;lt;input id=&amp;quot;loginTest_RememberMe&amp;quot; type=&amp;quot;checkbox&amp;quot; name=&amp;quot;loginTest$RememberMe&amp;quot; /&amp;gt;
            &amp;lt;label for=&amp;quot;loginTest_RememberMe&amp;quot;&amp;gt;Remember me next time.&amp;lt;/label&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td align=&amp;quot;right&amp;quot; colspan=&amp;quot;2&amp;quot;&amp;gt;
            &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;loginTest$LoginButton&amp;quot; value=&amp;quot;Log In&amp;quot; 
              onclick=&amp;quot;…&amp;quot; id=&amp;quot;loginTest_LoginButton&amp;quot; /&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;A CSS-related issue with this in earlier versions of ASP.NET is the outer table which you haven’t previously been able to remove (but which ironically was added as a wrapper in to give you better control over your styles). Set the Login control’s RenderOuterTable property to &lt;em&gt;false&lt;/em&gt; and this will lose that table no matter what CVCR is set to.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table cellpadding=&amp;quot;0&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;
  &amp;lt;tr&amp;gt;
    &amp;lt;td align=&amp;quot;center&amp;quot; colspan=&amp;quot;2&amp;quot;&amp;gt;Log In&amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;
    &amp;lt;td align=&amp;quot;right&amp;quot;&amp;gt;
      &amp;lt;label for=&amp;quot;loginTest_UserName&amp;quot;&amp;gt;User Name:&amp;lt;/label&amp;gt;
    &amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;
      &amp;lt;input name=&amp;quot;loginTest$UserName&amp;quot; type=&amp;quot;text&amp;quot; id=&amp;quot;loginTest_UserName&amp;quot; /&amp;gt;
      &amp;lt;span id=&amp;quot;loginTest_UserNameRequired&amp;quot; title=&amp;quot;User Name is required.&amp;quot; 
        style=&amp;quot;color:Red;visibility:hidden;&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;
    &amp;lt;td align=&amp;quot;right&amp;quot;&amp;gt;
      &amp;lt;label for=&amp;quot;loginTest_Password&amp;quot;&amp;gt;Password:&amp;lt;/label&amp;gt;
    &amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;
      &amp;lt;input name=&amp;quot;loginTest$Password&amp;quot; type=&amp;quot;password&amp;quot; id=&amp;quot;loginTest_Password&amp;quot; /&amp;gt;
      &amp;lt;span id=&amp;quot;loginTest_PasswordRequired&amp;quot; title=&amp;quot;Password is required.&amp;quot; 
        style=&amp;quot;color:Red;visibility:hidden;&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;
    &amp;lt;td colspan=&amp;quot;2&amp;quot;&amp;gt;
      &amp;lt;input id=&amp;quot;loginTest_RememberMe&amp;quot; type=&amp;quot;checkbox&amp;quot; name=&amp;quot;loginTest$RememberMe&amp;quot; /&amp;gt;
      &amp;lt;label for=&amp;quot;loginTest_RememberMe&amp;quot;&amp;gt;Remember me next time.&amp;lt;/label&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;
    &amp;lt;td align=&amp;quot;right&amp;quot; colspan=&amp;quot;2&amp;quot;&amp;gt;
      &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;loginTest$LoginButton&amp;quot; value=&amp;quot;Log In&amp;quot; 
        onclick=&amp;quot;…&amp;quot; id=&amp;quot;loginTest_LoginButton&amp;quot; /&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;Not ground-shattering certainly, but definitely handy. &lt;/p&gt;

&lt;h2&gt;What We’ve Learnt&lt;/h2&gt;

&lt;p&gt;In today’s episode, we’ve learnt that Microsoft has taken the opportunity in ASP.NET 4.0 to clean up a great deal of the HTML emitted by its server controls, thus making it CSS-friendlier. A new setting in web.config called &lt;em&gt;ControlRenderingCompatibilityVersion&lt;/em&gt; indicates whether controls should render as cleaner HTML or as they did in 3.5. We saw two example of the cleaner HTML in effect in the Menu and Image control and noted that while some of the more complex controls have not had their markup cleaned up, a subset of those now have a RenderOuterTable property which allows you to remove some of it manually.&lt;/p&gt;

&lt;p&gt;Incidentally, for those of you with sites that you can’t upgrade to .NET 4.0, a group of enterprising souls are continuing to work on the CSS Friendly Adapters mentioned earlier. You’ll find this revitalization &lt;a title="CSS Friendly Adapters projec on Google Code" href="http://code.google.com/p/aspnetcontroladapters/"&gt;here on Google Code&lt;/a&gt;. Happy coding!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=CvxO_wu5i8U:pG9BF8wD01U:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=CvxO_wu5i8U:pG9BF8wD01U:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=CvxO_wu5i8U:pG9BF8wD01U:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=CvxO_wu5i8U:pG9BF8wD01U:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=CvxO_wu5i8U:pG9BF8wD01U:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=CvxO_wu5i8U:pG9BF8wD01U:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=CvxO_wu5i8U:pG9BF8wD01U:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=CvxO_wu5i8U:pG9BF8wD01U:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/CvxO_wu5i8U" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/CvxO_wu5i8U/post.aspx</link>
      <author>DanM</author>
      <comments>http://blog.hmobius.com/post/2010/03/03/ASPNET-Part-9-Rendering-Cleaner-HTML.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=c95fc991-7c02-45cf-a07b-663fd5d8d2b8</guid>
      <pubDate>Wed, 03 Mar 2010 02:00:00 +0000</pubDate>
      <category>ASP.NET</category>
      <category>Geek Stuff</category>
      <dc:publisher>DanM</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=c95fc991-7c02-45cf-a07b-663fd5d8d2b8</pingback:target>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=c95fc991-7c02-45cf-a07b-663fd5d8d2b8</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/03/03/ASPNET-Part-9-Rendering-Cleaner-HTML.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=c95fc991-7c02-45cf-a07b-663fd5d8d2b8</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=c95fc991-7c02-45cf-a07b-663fd5d8d2b8</feedburner:origLink></item>
    <item>
      <title>Today's Bookmarks (25 Feb 2010)</title>
      <description>&lt;ul class="delicious"&gt;
&lt;li&gt;
&lt;div class="delicious-link"&gt;&lt;a href="http://blogs.msdn.com/aspnetue/archive/2010/02/23/asp-net-topics-on-msdn-the-top-10-list.aspx"&gt;ASP.NET Topics on MSDN &amp;ndash; The Top 10 List&lt;/a&gt;&lt;/div&gt;
&lt;div class="delicious-extended"&gt;Links pointing to the most popular ASP.NET topics on MSDN over the last year (02/2009 to 02/2010).&lt;/div&gt;
&lt;div class="delicious-tags"&gt;(tags: &lt;a rel="tag" href="http://delicious.com/hmobius/asp.net"&gt;asp.net&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/documentation"&gt;documentation&lt;/a&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div class="delicious-link"&gt;&lt;a href="http://code.msdn.microsoft.com/Project/ProjectDirectory.aspx?TagName=WebAppToolkits"&gt;Microsoft Web App Toolkits&lt;/a&gt;&lt;/div&gt;
&lt;div class="delicious-extended"&gt;List of currently available web app toolkits on MSDN Code Gallery. Full docs as well&lt;/div&gt;
&lt;div class="delicious-tags"&gt;(tags: &lt;a href="http://delicious.com/hmobius/asp.net"&gt;asp.net&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/tools"&gt;tools&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/rest"&gt;rest&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/c%23"&gt;c#&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/tutorial"&gt;tutorial&lt;/a&gt; &lt;a rel="tag" href="http://delicious.com/hmobius/documentation"&gt;documentation&lt;/a&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=8FYuwFGp4_Q:QzDwTLP2dc8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=8FYuwFGp4_Q:QzDwTLP2dc8:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=8FYuwFGp4_Q:QzDwTLP2dc8:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=8FYuwFGp4_Q:QzDwTLP2dc8:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=8FYuwFGp4_Q:QzDwTLP2dc8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=8FYuwFGp4_Q:QzDwTLP2dc8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=8FYuwFGp4_Q:QzDwTLP2dc8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=8FYuwFGp4_Q:QzDwTLP2dc8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/8FYuwFGp4_Q" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/8FYuwFGp4_Q/post.aspx</link>
      <author>Dan@Delicious</author>
      <comments>http://blog.hmobius.com/post/2010/02/25/Todays-Bookmarks-(25-Feb-2010).aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=43d347b3-891f-4b2c-a15c-2055444daced</guid>
      <pubDate>Thu, 25 Feb 2010 05:04:00 +0000</pubDate>
      <category>Bookmarks</category>
      <dc:publisher>Dan@Delicious</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=43d347b3-891f-4b2c-a15c-2055444daced</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=43d347b3-891f-4b2c-a15c-2055444daced</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/02/25/Todays-Bookmarks-(25-Feb-2010).aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=43d347b3-891f-4b2c-a15c-2055444daced</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=43d347b3-891f-4b2c-a15c-2055444daced</feedburner:origLink></item>
    <item>
      <title>ASP.NET, Part 8: Introducing ClientIDMode</title>
      <description>&lt;p&gt;Welcome to part 8 of &lt;a href="http://blog.hmobius.com/post/2010/02/09/ASPNET-40-Cometh.aspx"&gt;my tour through ASP.NET 4.0&lt;/a&gt;. In this episode, we’ll look at a new feature that directly affects two things: page size (and thus scalability and perceived performance) and the use of JavaScript APIs such jQuery. It’s called &lt;em&gt;ClientIDMode&lt;/em&gt;.&lt;/p&gt;  &lt;h2&gt;The Problem&lt;/h2&gt;  &lt;p&gt;Consider a typical development situation. You’re building a page which inherits its structure from a master page or two. The page itself contains a custom user control which its own set of server-side controls in it.&amp;#160; In this particular example, let’s have a simple table.&lt;/p&gt;  &lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;%@ Control Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; 
    CodeFile=&amp;quot;UserControl.ascx.cs&amp;quot; Inherits=&amp;quot;UserControl&amp;quot; %&amp;gt;
&amp;lt;asp:Table runat=&amp;quot;server&amp;quot; ID=&amp;quot;tblInfo&amp;quot;&amp;gt;
  &amp;lt;asp:TableRow runat=&amp;quot;server&amp;quot; ID=&amp;quot;tblTopRow&amp;quot;&amp;gt;
    &amp;lt;asp:TableCell runat=&amp;quot;server&amp;quot; ID=&amp;quot;tdTopLeft&amp;quot;&amp;gt;
      &amp;lt;asp:Label runat=&amp;quot;server&amp;quot; ID=&amp;quot;lblChoices&amp;quot; Text=&amp;quot;Choices&amp;quot; /&amp;gt;
    &amp;lt;/asp:TableCell&amp;gt;
    &amp;lt;asp:TableCell runat=&amp;quot;server&amp;quot; ID=&amp;quot;tdTopRight&amp;quot;&amp;gt;
      &amp;lt;asp:DropDownList runat=&amp;quot;server&amp;quot; ID=&amp;quot;ddlChoiceList&amp;quot;&amp;gt;
        &amp;lt;asp:ListItem Text=&amp;quot;Choice One&amp;quot; /&amp;gt;
        &amp;lt;asp:ListItem Text=&amp;quot;Choice Two&amp;quot; /&amp;gt;
        &amp;lt;asp:ListItem Text=&amp;quot;Choice Three&amp;quot; /&amp;gt;
      &amp;lt;/asp:DropDownList&amp;gt;
    &amp;lt;/asp:TableCell&amp;gt;
  &amp;lt;/asp:TableRow&amp;gt;
&amp;lt;/asp:Table&amp;gt;&lt;/pre&gt;

&lt;p&gt;On running this page, we’ll see that the generated HTML for the table is perhaps not as succinct as we might otherwise wish. (Note that main and submain are the names of ContentPlaceholder controls in the master pages that the page containing the table is based on.)&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table id=&amp;quot;ctl00_ctl00_main_submain_uc1Control_tblInfo&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt; 
  &amp;lt;tr id=&amp;quot;ctl00_ctl00_main_submain_uc1Control_tblTopRow&amp;quot;&amp;gt; 
    &amp;lt;td id=&amp;quot;ctl00_ctl00_main_submain_uc1Control_tdTopLeft&amp;quot;&amp;gt;
      &amp;lt;span id=&amp;quot;ctl00_ctl00_main_submain_uc1Control_lblChoices&amp;quot;&amp;gt;Choices&amp;lt;/span&amp;gt;
    &amp;lt;/td&amp;gt;
    &amp;lt;td id=&amp;quot;ctl00_ctl00_main_submain_uc1Control_tdTopRight&amp;quot;&amp;gt;
      &amp;lt;select name=&amp;quot;ctl00$ctl00$main$submain$uc1Control$ddlChoiceList&amp;quot; 
              id=&amp;quot;ctl00_ctl00_main_submain_uc1Control_ddlChoiceList&amp;quot;&amp;gt; 
        &amp;lt;option value=&amp;quot;Choice One&amp;quot;&amp;gt;Choice One&amp;lt;/option&amp;gt; 
        &amp;lt;option value=&amp;quot;Choice Two&amp;quot;&amp;gt;Choice Two&amp;lt;/option&amp;gt; 
        &amp;lt;option value=&amp;quot;Choice Three&amp;quot;&amp;gt;Choice Three&amp;lt;/option&amp;gt; 
      &amp;lt;/select&amp;gt;
    &amp;lt;/td&amp;gt; 
  &amp;lt;/tr&amp;gt; 
&amp;lt;/table&amp;gt; &lt;/pre&gt;

&lt;p&gt;When ASP.NET was first created, it was decided that it should autogenerate IDs for each element on the page based on the chain of their parent naming containers. This would mean that you would not be able to generate an HTML page where two elements had the same ID. As you can see above, the IDs generated in this way are neither particularly short nor semantically meaningful, but they are unique. &lt;/p&gt;

&lt;p&gt;The length and meaning of client-side IDs didn’t matter back in 2000, but the invention and subsequent mass adoption of AJAX a few years ago has repopularised client-side scripting on the page. Scripting libraries like jQuery have only sped this tide of JavaScript up further thanks to the ease with which quite complex, cross-browser functionality can be achieved. And if there’s one thing that JavaScript uses a lot, it’s the ID of elements on a page to identify them. &lt;/p&gt;

&lt;p&gt;The problem with ASP.NET up to v3.5 then is that there is no way to dictate the client-side ID of an HTML element and it’s hard to know exactly what the ‘AutoID’ will be for use in your scripts. A fairly complex page with several dozen controls on it will also be significantly larger than it needs to be because of AutoIDs and on high-volume sites, that means extra bandwidth used unnecessarily (and so more cost) and a perceived performance hit on the site from users with slower connections waiting for the page to download.&lt;/p&gt;

&lt;h2&gt;The Solution&lt;/h2&gt;

&lt;p&gt;It is possible to work around this issue in several ways, but with the new ClientIDMode property in ASP.NET 4.0, we’re presented with a way to instruct ASP.NET to generate element IDs in one of three ways. This new property can be set for any webform control, page, or master page. It can also be set as a property of the &amp;lt;system.web&amp;gt;/&amp;lt;pages&amp;gt; element in web.config.&amp;#160; &lt;/p&gt;

&lt;p&gt;ClientIDMode has four possible values&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;AutoID&lt;/em&gt; has ASP.NET generate IDs as it does in v3.5 and earlier versions. &lt;/li&gt;

  &lt;li&gt;&lt;em&gt;Static&lt;/em&gt; has ASP.NET use exactly the same ID given to the server control for its client-side ID. &lt;/li&gt;

  &lt;li&gt;&lt;em&gt;Predictable&lt;/em&gt; has ASP.NET try to generate IDs that are guessable from looking at the structure of the page. It tries to strike a happy medium between AutoID and Static. It is also the default value for ClientIDMode in ASP.NET 4.0. &lt;/li&gt;

  &lt;li&gt;&lt;em&gt;Inherit&lt;/em&gt; has ASP.NET generate a client-side ID for the page or control using the same method as its parent. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s taking the example code above, and see how the &amp;lt;table&amp;gt; element is rendered in each ClientIDMode. First, let’s set the &amp;lt;asp:Table&amp;gt; control’s ClientIDMode to &lt;em&gt;Predictable&lt;/em&gt;. As noted, this is the default in ASP.NET 4.0, so we need add no extra property. The resultant HTML looks like this:&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table id=&amp;quot;main_submain_uc1Control_tblInfo&amp;quot;&amp;gt;
  &amp;lt;tr id=&amp;quot;main_submain_uc1Control_tblTopRow&amp;quot;&amp;gt;
    &amp;lt;td id=&amp;quot;main_submain_uc1Control_tdTopLeft&amp;quot;&amp;gt;
      &amp;lt;span id=&amp;quot;main_submain_uc1Control_lblChoices&amp;quot;&amp;gt;Choices&amp;lt;/span&amp;gt;
    &amp;lt;/td&amp;gt;
    &amp;lt;td id=&amp;quot;main_submain_uc1Control_tdTopRight&amp;quot;&amp;gt;
      &amp;lt;select name=&amp;quot;ctl00$ctl00$main$submain$uc1Control$ddlChoiceList&amp;quot; 
              id=&amp;quot;main_submain_uc1Control_ddlChoiceList&amp;quot;&amp;gt;
        &amp;lt;option value=&amp;quot;Choice One&amp;quot;&amp;gt;Choice One&amp;lt;/option&amp;gt;
        &amp;lt;option value=&amp;quot;Choice Two&amp;quot;&amp;gt;Choice Two&amp;lt;/option&amp;gt;
        &amp;lt;option value=&amp;quot;Choice Three&amp;quot;&amp;gt;Choice Three&amp;lt;/option&amp;gt;
      &amp;lt;/select&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;As you can see, the resultant IDs are mostly the same as the v3.5 ones but are no longer prepended with a (random) number of ctl00_ strings. Now let’s set ClientIDMode on the table to &lt;em&gt;AutoID&lt;/em&gt;.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:Table runat=&amp;quot;server&amp;quot; ID=&amp;quot;tblInfo&amp;quot; ClientIDMode=&amp;quot;AutoID&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;This should generate old-style IDs for everything again as would happen in v3.5, but actually something different happens.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table id=&amp;quot;ctl00_ctl00_main_submain_uc1Control_tblInfo&amp;quot;&amp;gt;
  &amp;lt;tr id=&amp;quot;main_submain_uc1Control_tblTopRow&amp;quot;&amp;gt;
    &amp;lt;td id=&amp;quot;main_submain_uc1Control_tdTopLeft&amp;quot;&amp;gt;
      &amp;lt;span id=&amp;quot;main_submain_uc1Control_lblChoices&amp;quot;&amp;gt;Choices&amp;lt;/span&amp;gt;
    &amp;lt;/td&amp;gt;
    &amp;lt;td id=&amp;quot;main_submain_uc1Control_tdTopRight&amp;quot;&amp;gt;
      &amp;lt;select name=&amp;quot;ctl00$ctl00$main$submain$uc1Control$ddlChoiceList&amp;quot; 
              id=&amp;quot;main_submain_uc1Control_ddlChoiceList&amp;quot;&amp;gt;
        &amp;lt;option value=&amp;quot;Choice One&amp;quot;&amp;gt;Choice One&amp;lt;/option&amp;gt;
        &amp;lt;option value=&amp;quot;Choice Two&amp;quot;&amp;gt;Choice Two&amp;lt;/option&amp;gt;
        &amp;lt;option value=&amp;quot;Choice Three&amp;quot;&amp;gt;Choice Three&amp;lt;/option&amp;gt;
      &amp;lt;/select&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;As you can see, &lt;em&gt;only the ID for the table itself&lt;/em&gt; has been generated in the v3.5 way. Every other ID is still generated using the ‘Predictable Mode’ algorithm. Now try setting ClientIDMode to &lt;em&gt;AutoID&lt;/em&gt; as an attribute of the @Master, @Page, or @Control directive. For example&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;%@ Control Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; 
    CodeFile=&amp;quot;UserControl.ascx.cs&amp;quot; Inherits=&amp;quot;UserControl&amp;quot; 
    ClientIDMode=&amp;quot;AutoID&amp;quot; %&amp;gt;&lt;/pre&gt;

&lt;p&gt;Sure enough, all the IDs for the table and its children have changed back to the v3.5 naming style as seen earlier. Try setting ClientIDMode to &lt;em&gt;Static&lt;/em&gt;.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;%@ Control Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; 
    CodeFile=&amp;quot;UserControl.ascx.cs&amp;quot; Inherits=&amp;quot;UserControl&amp;quot; 
    ClientIDMode=&amp;quot;Static&amp;quot; %&amp;gt;&lt;/pre&gt;

&lt;p&gt;Straight to the mark, the HTML element IDs now match their respective server-side control IDs exactly (but their &lt;em&gt;name&lt;/em&gt; attributes are still generated as in v3.5-)&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table id=&amp;quot;tblInfo&amp;quot;&amp;gt;
  &amp;lt;tr id=&amp;quot;tblTopRow&amp;quot;&amp;gt;
    &amp;lt;td id=&amp;quot;tdTopLeft&amp;quot;&amp;gt;
      &amp;lt;span id=&amp;quot;lblChoices&amp;quot;&amp;gt;Choices&amp;lt;/span&amp;gt;
    &amp;lt;/td&amp;gt;
    &amp;lt;td id=&amp;quot;tdTopRight&amp;quot;&amp;gt;
      &amp;lt;select name=&amp;quot;ctl00$ctl00$main$submain$uc1Control$ddlChoiceList&amp;quot; 
              id=&amp;quot;ddlChoiceList&amp;quot;&amp;gt;
        &amp;lt;option value=&amp;quot;Choice One&amp;quot;&amp;gt;Choice One&amp;lt;/option&amp;gt;
        &amp;lt;option value=&amp;quot;Choice Two&amp;quot;&amp;gt;Choice Two&amp;lt;/option&amp;gt;
        &amp;lt;option value=&amp;quot;Choice Three&amp;quot;&amp;gt;Choice Three&amp;lt;/option&amp;gt;
      &amp;lt;/select&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;Move the ClientIDMode attribute back from the @Control directive to the &amp;lt;asp:Table&amp;gt; element and you’ll see only the &amp;lt;table&amp;gt; element return its shorter ID with the rest returning to their ‘predictable’ form.&lt;/p&gt;

&lt;p&gt;The rule then is that ClientIDMode only changes the ID generation mode for the control on which it is set. It does not affect the ID generation mode for its child controls. The only way to change the default ClientIDMode for more than one control at a time is to set it in the @Control, @Page, or @Master directives or in web.config. The only exception to this is when setting ClientIDMode on templated list controls as we’ll see later.&lt;/p&gt;

&lt;p&gt;If you already use jQuery in your v3.5 sites and want to upgrade them to use the v4 Framework, you would be well may need to default the ClientIDMode for the site to AutoID in web.config until you’ve checked your code works against predictable mode.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;configuration&amp;gt;
  &amp;lt;system.web&amp;gt;
    ...
    &amp;lt;pages clientIDMode=&amp;quot;AutoID&amp;quot; /&amp;gt;
    ...
  &amp;lt;/system.web&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;

&lt;p&gt;In general however, a good approach to using ClientIDMode is to leave 'Predictable' as the default and for those few controls which are targeted by JQuery, set ClientIDMode to Static. ASP.NET will not interfere with an ID set as static so if you inadvertently set two or more identical IDs in a page, you’ll have to identify and disambiguate them yourself.&lt;/p&gt;

&lt;h2&gt;Using ClientIDRowSuffix With Templated List Controls&lt;/h2&gt;

&lt;p&gt;Consider the case where you’re binding some data into a Templated List control. For example a ListView. &lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; 
    CodeFile=&amp;quot;DataBoundControls.aspx.cs&amp;quot; Inherits=&amp;quot;DataBoundControls&amp;quot; %&amp;gt;
...
&amp;lt;body&amp;gt;
  &amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;asp:ListView runat=&amp;quot;server&amp;quot; ID=&amp;quot;lvwDemo&amp;quot;&amp;gt;
      &amp;lt;LayoutTemplate&amp;gt;
        &amp;lt;table&amp;gt;
          &amp;lt;asp:PlaceHolder runat=&amp;quot;server&amp;quot; ID=&amp;quot;itemPlaceholder&amp;quot; /&amp;gt;
        &amp;lt;/table&amp;gt;
      &amp;lt;/LayoutTemplate&amp;gt;
      &amp;lt;ItemTemplate&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td&amp;gt;
            &amp;lt;asp:Label runat=&amp;quot;server&amp;quot; ID=&amp;quot;lblItemName&amp;quot; Text='&amp;lt;%#Eval(&amp;quot;Name&amp;quot;) %&amp;gt;' /&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/ItemTemplate&amp;gt;
    &amp;lt;/asp:ListView&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;

&lt;p&gt;And in the code-behind, a simple List is bound to the ListView.&lt;/p&gt;

&lt;pre class="brush: csharp; auto-links: false;"&gt;protected void Page_Load(object sender, EventArgs e)
{
  List&amp;lt;Item&amp;gt; items = new List&amp;lt;Item&amp;gt; {
    new Item { Id = 11, Name = &amp;quot;Cat&amp;quot; },
    new Item { Id = 12, Name = &amp;quot;Dog&amp;quot; },
    new Item { Id = 13, Name = &amp;quot;Dragon&amp;quot; }
  };

  lvwDemo.DataSource = items;
  lvwDemo.DataBind();
}&lt;/pre&gt;

&lt;p&gt;With all defaults left on, a ClientIDMode of ‘Predictable’ produces the following HTML for the table templated in the ListView.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_0&amp;quot;&amp;gt;Cat&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_1&amp;quot;&amp;gt;Dog&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_2&amp;quot;&amp;gt;Dragon&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;Note that an auto-incremented number is used to make the id for the span unique. You can replace that auto-incremented number with something more meaningful using the new ClientIDRowSuffix property on the ListView. The defines the data field (typically the primary key) whose value is suffixed to the row ID to make it unique. If we set it to Id on the ListView…&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:ListView runat=&amp;quot;server&amp;quot; ID=&amp;quot;lvwDemo&amp;quot; ClientIDRowSuffix=&amp;quot;Id&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;the Id for each Item object in the list is used in the span ids.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_11&amp;quot;&amp;gt;Cat&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_12&amp;quot;&amp;gt;Dog&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_13&amp;quot;&amp;gt;Dragon&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;We could set it to Name instead of Id, as long as we can guarantee that Name is a unique field and get the following HTML.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_Cat&amp;quot;&amp;gt;Cat&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_Dog&amp;quot;&amp;gt;Dog&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_Dragon&amp;quot;&amp;gt;Dragon&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;ClientIDRowSuffix actually takes a string[], so you can set multiple fields to this property should you wish. FOr example,&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:ListView runat=&amp;quot;server&amp;quot; ID=&amp;quot;lvwDemo&amp;quot; ClientIDRowSuffix=&amp;quot;Id, Name&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;will generate the following.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_11_Cat&amp;quot;&amp;gt;Cat&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_12_Dog&amp;quot;&amp;gt;Dog&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_lblItemName_13_Dragon&amp;quot;&amp;gt;Dragon&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;A second new property – ClientIDRowSuffixDataKeys – will return the values used to generate the client ID for a given row.&lt;/p&gt;

&lt;h3&gt;ClientIDRowSuffix and Static\AutoID Modes Don’t Mix&lt;/h3&gt;

&lt;p&gt;Be aware that ClientIDRowSuffix has no effect on either AutoID or Static ID modes and also that server-side controls placed within templates DO inherit the ClientIDMode of their parent control – in this case, the ListView or GridView in whose templates they are placed. For example, should you set ClientIDMode to Static on the ListView control in the current example…&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:ListView runat=&amp;quot;server&amp;quot; ID=&amp;quot;lvwDemo&amp;quot; ClientIDRowSuffix=&amp;quot;Id&amp;quot; ClientIDMode=&amp;quot;Static&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;every span id will remain identical despite the presence of ClientIDRowSuffix.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lblItemName&amp;quot;&amp;gt;Cat&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lblItemName&amp;quot;&amp;gt;Dog&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lblItemName&amp;quot;&amp;gt;Dragon&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;If you set it AutoID rather than Static, this is not a problem as AutoIDs are unique by design but there’s no influence on them via ClientIDRowSuffix either. &lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_ctrl0_lblItemName&amp;quot;&amp;gt;Cat&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_ctrl1_lblItemName&amp;quot;&amp;gt;Dog&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;lvwDemo_ctrl2_lblItemName&amp;quot;&amp;gt;Dragon&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;p&gt;You could set the ClientIDMode to Predictable on the Label control in your template &lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:ListView runat=&amp;quot;server&amp;quot; ID=&amp;quot;lvwDemo&amp;quot; ClientIdRowSuffix=&amp;quot;Id&amp;quot; ClientIDMode=&amp;quot;Static&amp;quot;&amp;gt;
  ...
  &amp;lt;ItemTemplate&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;td&amp;gt;
        &amp;lt;asp:Label ClientIDMode=&amp;quot;Predictable&amp;quot;
          runat=&amp;quot;server&amp;quot; ID=&amp;quot;lblItemName&amp;quot; Text='&amp;lt;%#Eval(&amp;quot;Name&amp;quot;) %&amp;gt;' /&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/ItemTemplate&amp;gt;
&amp;lt;/asp:ListView&amp;gt;&lt;/pre&gt;

&lt;p&gt;but then you’ll notice that the span ids become slightly less predictable than you might like.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;table&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;ctrl0_lblItemName_11&amp;quot;&amp;gt;Cat&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;ctrl1_lblItemName_12&amp;quot;&amp;gt;Dog&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;span id=&amp;quot;ctrl2_lblItemName_13&amp;quot;&amp;gt;Dragon&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/pre&gt;

&lt;h2&gt;What We’ve Learnt&lt;/h2&gt;

&lt;p&gt;In this episode, we’ve seen that the new &lt;em&gt;ClientIDMode&lt;/em&gt; property gives us more control over the client-side IDs generated by server-side controls. This helps both with keeping the overall size of the page down and for referencing the correct client-side IDs in our Javascript code. We’ve seen when ClientIDMode affects or does not affect the child controls of the one on which it is set and also how &lt;em&gt;ClientIDRowSuffix&lt;/em&gt; augments predictable mode when it comes to generating IDs for controls within the templates of a databound list control. We also noted that &lt;em&gt;ClientIDRowSuffixDataKeys&lt;/em&gt; returns the values of the keys set in ClientIDRowSuffix used to generate a unique ID for a given row.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=OPm792AJ3BA:NmBp3p2NHEo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=OPm792AJ3BA:NmBp3p2NHEo:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=OPm792AJ3BA:NmBp3p2NHEo:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=OPm792AJ3BA:NmBp3p2NHEo:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=OPm792AJ3BA:NmBp3p2NHEo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=OPm792AJ3BA:NmBp3p2NHEo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=OPm792AJ3BA:NmBp3p2NHEo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=OPm792AJ3BA:NmBp3p2NHEo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/OPm792AJ3BA" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/OPm792AJ3BA/post.aspx</link>
      <author>DanM</author>
      <comments>http://blog.hmobius.com/post/2010/02/25/ASPNET-Part-8-Introducing-ClientIDMode.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=2ff0af9d-44c8-4d0f-9d38-f1dfd097f735</guid>
      <pubDate>Thu, 25 Feb 2010 02:00:00 +0000</pubDate>
      <category>ASP.NET</category>
      <category>Geek Stuff</category>
      <dc:publisher>DanM</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=2ff0af9d-44c8-4d0f-9d38-f1dfd097f735</pingback:target>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=2ff0af9d-44c8-4d0f-9d38-f1dfd097f735</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/02/25/ASPNET-Part-8-Introducing-ClientIDMode.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=2ff0af9d-44c8-4d0f-9d38-f1dfd097f735</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=2ff0af9d-44c8-4d0f-9d38-f1dfd097f735</feedburner:origLink></item>
    <item>
      <title>ASP.NET, Part 7: A New Viewstate Opt-in Model</title>
      <description>&lt;p&gt;Welcome to part 7 of &lt;a title="Index of all posts in this series" href="http://blog.hmobius.com/post/2010/02/09/ASPNET-40-Cometh.aspx"&gt;my tour through ASP.NET 4.0&lt;/a&gt;. Today we’re going to look at what in hindsight was one of the larger design mistakes that Microsoft made when creating ASP.NET – The View State Opt-Out Model for Web Forms – and how they’ve approached a solution. &lt;/p&gt;  &lt;p&gt;[&lt;em&gt;Updated Feb 24: Added link to more in-depth tutorial on View State at end of article&lt;/em&gt;].&lt;/p&gt;  &lt;h2&gt;HTTP is Stateless&lt;/h2&gt;  &lt;p&gt;One of the first things you learn as a web developer is that HTTP is a &lt;em&gt;stateless protocol&lt;/em&gt;. Requests sent over HTTP are independent of any that have gone before and retain no information about the user sending them or the state of the page (where the state is defined as the property values of the controls that make up the page’s control hierarchy.)&lt;/p&gt;  &lt;p&gt;The issue then is how to retain such information between requests and, more significantly in this discussion, between postbacks on the same page. The standard solutions are to&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Put it in session state &lt;/li&gt;    &lt;li&gt;Put it in the URL &lt;/li&gt;    &lt;li&gt;Put it in a cookie &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Enter View State&lt;/h2&gt;  &lt;p&gt;Back in 2000, View State was created by Microsoft so we fledgling web developers didn’t have to worry about persisting this state information onto the next page. It was just another great feature whereby this information was base64-encoded on the server and stored in a hidden form element on the page named __VIEWSTATE. When the page was posted back, View State would be sent back with it and hey presto, instant state. &lt;/p&gt;  &lt;p&gt;Ten years later, the benefit of using View State is still apparent but, as any ASP.NET MVC developer will tell you, it is not a necessary part of a web page. (To whit, MVC doesn’t use View State at all.) There are two main issues with View State&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;All pages take a performance hit as the server must deal with decrypting, reading, rebuilding and re-encrypting view state with each post back of a page to the server. &lt;a title="MSDN Article on Understanding View State by Scott Mitchell" href="http://msdn.microsoft.com/en-gb/library/ms972976.aspx"&gt;The exact process is described here&lt;/a&gt;. Pages which dynamically add controls to the page may also cause exceptions when the server cannot match the control tree in the view state to that on the page. &lt;/li&gt;    &lt;li&gt;The value in the __VIEWSTATE hidden form field can grow quite large quite quickly. Without you realising it, it could add several dozen kilobytes to your page resulting in slower transmission times to your users and back to the server when it is sent back to the server in the HTTP POST headers. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The solution to both these problems for Web Forms developers is to make sure that only the controls which need their state persisted across postbacks are included in View State and herein lies the main problem with View State that is being addressed in ASP.NET 4.0.&lt;/p&gt;  &lt;h2&gt;Opt-Out Mode vs. Opt-In Mode &lt;/h2&gt;  &lt;p&gt;From ASP.NET v1.0 to v3.5 SP1, there has only been an &lt;em&gt;opt-out&lt;/em&gt; model for View State on a Web Forms page. This means that View State is switched on for every control on every page by default, unless you opt to disable it by setting the Page or Control’s EnableViewState property to false. The problem is that once EnableViewState is set to false for a Page for example, it is also set to false for every child control of that page, and there is no facility to override that further down the tree and have View State switched on for a control on that page. &lt;/p&gt;  &lt;p&gt;Consider the scenario where I have several dozen form controls on a page and wish to maintain view state for just one DropDownList. I cannot set EnableViewState to false for the whole Page and then set it to True for the DropDownList. Instead I must leave EnableViewState set to true on the page and explicitly set it to false for every other control on the page as long as it isn’t a parent control for the DropDownList.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;Which isn’t too great.&lt;/p&gt;  &lt;p&gt;Fortunately, Microsoft has heeded our cries and added an opt-in model for View State in ASP.NET 4.0. Addressing the same scenario using the opt-in model, I can indeed switch off View State for the whole Page and then re-enable it explicitly on the one DropDownList I need to maintain state for. However, I do it with a new property called &lt;em&gt;ViewStateMode&lt;/em&gt; rather than EnableViewState.&lt;/p&gt;  &lt;h2&gt;Introducing ViewStateMode&lt;/h2&gt;  &lt;p&gt;The switch between opt-out and opt-in models is made using the new &lt;em&gt;ViewStateMode&lt;/em&gt; property. This has three possible values.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Enabled (the default for a Page) : sets the page \ control to the old school opt-out mode &lt;/li&gt;    &lt;li&gt;Disabled : sets the page \ control to use the new opt-in mode. &lt;/li&gt;    &lt;li&gt;Inherit (the default for a user control) : sets the control to inherit the setting from its parent page \ control. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;It can be set both code-behind and declaratively in markup as an attribute of a control or of the @Page directive.&lt;/p&gt;  &lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;%@Page ... ViewStateMode=&amp;quot;Disabled&amp;quot; %&amp;gt;&lt;/pre&gt;

&lt;p&gt;Let’s take an example. In the code below, we have a normal WebForms page with EnableViewState set to true by default.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; 
    AutoEventWireup=&amp;quot;true&amp;quot; CodeFile=&amp;quot;ViewStateDemo.aspx.cs&amp;quot;
    Inherits=&amp;quot;ViewStateDemo&amp;quot; %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; 
   &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;head runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;title&amp;gt;View State Demo&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
&amp;lt;div&amp;gt;
  &amp;lt;asp:PlaceHolder runat=&amp;quot;server&amp;quot; ID=&amp;quot;plhOuter&amp;quot;&amp;gt;
    &amp;lt;asp:Label runat=&amp;quot;server&amp;quot; ID=&amp;quot;lblOne&amp;quot; Text=&amp;quot;My Initial Value&amp;quot; /&amp;gt;&amp;lt;br /&amp;gt;
    &amp;lt;asp:Panel runat=&amp;quot;server&amp;quot; ID=&amp;quot;pnlInner&amp;quot;&amp;gt;
      &amp;lt;asp:Label runat=&amp;quot;server&amp;quot; ID=&amp;quot;lblTwo&amp;quot; Text=&amp;quot;My Initial Value&amp;quot; /&amp;gt;
    &amp;lt;/asp:Panel&amp;gt;
  &amp;lt;/asp:PlaceHolder&amp;gt;
  &amp;lt;br /&amp;gt;
  &amp;lt;asp:Button runat=&amp;quot;server&amp;quot; ID=&amp;quot;btnGo&amp;quot; Text=&amp;quot;View State Is Off&amp;quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;

&lt;p&gt;In the code-behind for this page, we re-set the Text properties for the two Labels and Button if the page has not posted back.&lt;/p&gt;

&lt;pre class="brush: csharp; auto-links: false;"&gt;protected void Page_Load(object sender, EventArgs e)
{
  if (!IsPostBack)
  {
    lblOne.Text = &amp;quot;My set value&amp;quot;;
    lblTwo.Text = &amp;quot;My set value&amp;quot;;
    btnGo.Text = &amp;quot;View State Is On&amp;quot;;
  }
}&lt;/pre&gt;

&lt;p&gt;When it loads, the page will load and the new Text values displayed. With View State enabled, those text values will stay the same when you click the button and post the page back to the server.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="With ViewState On Across the board" border="0" alt="With ViewState On Across the board" src="http://blog.hmobius.com/image.axd?picture=1_OnPageLoad.png" width="250" height="237" /&gt; &lt;/p&gt;

&lt;p&gt;Now set ViewStateMode to Disabled for on the plhOuter PlaceHolder control. &lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:PlaceHolder runat=&amp;quot;server&amp;quot; ID=&amp;quot;plhOuter&amp;quot; ViewStateMode=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;Now when you run the page and click the button, you’ll see that the two Labels lose their value as it is not persisted in View State. However, the Button control, which is outside the PlaceHolder still uses View State.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="View State Off On Outer Placeholder" border="0" alt="View State Off On Outer Placeholder" src="http://blog.hmobius.com/image.axd?picture=2_ViewStateOffOnOuter.png" width="250" height="237" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;So far, this is nothing new. We could replace the ViewStateMode property with EnableViewState set to false and get the same result. However, we could not then also set ViewStateMode to Enabled on the pnlInner Panel control and restore ViewState to the lblTwo Label control.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;asp:Panel runat=&amp;quot;server&amp;quot; ID=&amp;quot;pnlInner&amp;quot; ViewStateMode=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;Now run the page and click the button again to confirm that View State is now on for lblTwo. If you did try and replace ViewStateMode property with EnableViewState set to false on the plhOuter control now and hit the button, you’ll see that EnableViewState overrides ViewStateMode and produces the results in the screenshot above rather than the one below.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="ViewState On For Inner Panel" border="0" alt="ViewState On For Inner Panel" src="http://blog.hmobius.com/image.axd?picture=3_ViewStateOnForInnerPanel.png" width="250" height="237" /&gt; &lt;/p&gt;

&lt;p&gt;The ViewStateMode property can be set on any control or on the Page itself and not just invisible container controls as we’ve seen so far. Move ViewStateMode=”Disabled” from the plhOuter control to the @Page directive.&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: false;"&gt;&amp;lt;%@ Page ViewStateMode=&amp;quot;Disabled&amp;quot; Language=&amp;quot;C#&amp;quot; 
    AutoEventWireup=&amp;quot;true&amp;quot; CodeFile=&amp;quot;ViewStateDemo.aspx.cs&amp;quot;
    Inherits=&amp;quot;ViewStateDemo&amp;quot; %&amp;gt;&lt;/pre&gt;

&lt;p&gt;Run the page again and you’ll see how the Button control now also loses state across a post back while lblTwo continues to retain it as ViewStateMode is still enabled on it.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="ViewStateMode Disabled At Page Level" border="0" alt="ViewStateMode Disabled At Page Level" src="http://blog.hmobius.com/image.axd?picture=4_ViewStateModeDisabledAtPageLevel.png" width="250" height="237" /&gt; &lt;/p&gt;

&lt;h2&gt;Remember : View State is not Control State&lt;/h2&gt;

&lt;p&gt;While this demo adequately shows you how ViewStateMode is inherited through the Control hierarchy of a page, it would have failed had I tried to use TextBox or DropDownList controls instead of Labels with the code-behind setting their selected value or text. The DropDownList would have retained its SelectedIndex and the TextBox its Text whether View State was enabled or not because those particular properties are stored in &lt;em&gt;control state&lt;/em&gt;. Control state is designed for storing a control's essential data (such as a TextBox's text) that must be available on postback to enable the control to function even when view state has been disabled. Thus control state is always maintained even if EnableViewState is set to false and ViewStateMode is set to Disabled.&lt;/p&gt;

&lt;h2&gt;What We’ve Learnt&lt;/h2&gt;

&lt;p&gt;In today’s episode, we’ve seen that ASP.NET 4.0 presents a new opt-in mode for View State on a page via the new ViewStateMode property. However, we’ve also seen that setting the EnableViewState property to false will disable View State for any child control or page regardless of whether one has had ViewStateMode set to Enabled on it. Thus for any control’s state to be saved in a page’s View State, the following must be true.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;EnableViewState must be set to true for both the Page and the Control (which is the default setting) &lt;/li&gt;

  &lt;li&gt;ViewStateMode must be set to Enabled on the Control. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also noted that the setting of ViewStateMode has no influence over the workings of a Control’s Control State.&lt;/p&gt;

&lt;p&gt;For a really good, in-depth look at how View State works, you can look at both of these:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a title="MSDN Article on Understanding View State by Scott Mitchell" href="http://msdn.microsoft.com/en-gb/library/ms972976.aspx"&gt;MSDN Article on Understanding View State by Scott Mitchell&lt;/a&gt;.&lt;/li&gt;

  &lt;li&gt;&lt;a title="TRULY Understanding View State by Dave Reed" href="http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/truly-understanding-viewstate.aspx"&gt;TRULY Understanding View State by Dave Reed&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=wWNZ92hXJLg:MCokHx_3qUE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=wWNZ92hXJLg:MCokHx_3qUE:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=wWNZ92hXJLg:MCokHx_3qUE:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=wWNZ92hXJLg:MCokHx_3qUE:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=wWNZ92hXJLg:MCokHx_3qUE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=wWNZ92hXJLg:MCokHx_3qUE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DansArchive?a=wWNZ92hXJLg:MCokHx_3qUE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DansArchive?i=wWNZ92hXJLg:MCokHx_3qUE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DansArchive/~4/wWNZ92hXJLg" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/DansArchive/~3/wWNZ92hXJLg/post.aspx</link>
      <author>DanM</author>
      <comments>http://blog.hmobius.com/post/2010/02/24/ASPNET-Part-7-A-New-Viewstate-Opt-in-Model.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.hmobius.com/post.aspx?id=1d730832-ce17-44e3-9353-0e0704396d4c</guid>
      <pubDate>Wed, 24 Feb 2010 01:00:00 +0000</pubDate>
      <category>Geek Stuff</category>
      <dc:publisher>DanM</dc:publisher>
      <pingback:server>http://blog.hmobius.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.hmobius.com/post.aspx?id=1d730832-ce17-44e3-9353-0e0704396d4c</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://blog.hmobius.com/trackback.axd?id=1d730832-ce17-44e3-9353-0e0704396d4c</trackback:ping>
      <wfw:comment>http://blog.hmobius.com/post/2010/02/24/ASPNET-Part-7-A-New-Viewstate-Opt-in-Model.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.hmobius.com/syndication.axd?post=1d730832-ce17-44e3-9353-0e0704396d4c</wfw:commentRss>
    <feedburner:origLink>http://blog.hmobius.com/post.aspx?id=1d730832-ce17-44e3-9353-0e0704396d4c</feedburner:origLink></item>
  </channel>
</rss>
