<?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:dc="http://purl.org/dc/elements/1.1/" 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:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" version="2.0">
    <channel>
        <title>Sanjay Uttam</title>
        <link>http://geekswithblogs.net/SanjayU/Default.aspx</link>
        <description>Predominantly .NET</description>
        <language>en-US</language>
        <copyright>Sanjay Uttam</copyright>
        <managingEditor>Sanjay.Uttam@Gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Sanjay Uttam</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/SanjayU/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/geekswithblogs/gRLB" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="geekswithblogs/grlb" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
            <title>Closing a jQuery UI Dialog...</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2010/04/08/closing-a-jquery-ui-dialog.aspx</link>
            <description>&lt;p&gt;Why do I always forget this?&lt;/p&gt;  &lt;pre class="csharpcode"&gt;$(&lt;span class="str"&gt;'#someId).dialog('&lt;/span&gt;close');&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/139161.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay Uttam</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2010/04/08/closing-a-jquery-ui-dialog.aspx</guid>
            <pubDate>Thu, 08 Apr 2010 22:32:11 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2010/04/08/closing-a-jquery-ui-dialog.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/139161.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/139161.aspx</trackback:ping>
        </item>
        <item>
            <title>Create IEnumerable&amp;lt;T&amp;gt; with one line in LINQ</title>
            <category>C# Code-examples</category>
            <link>http://geekswithblogs.net/SanjayU/archive/2010/02/05/create-ienumerablelttgt-with-one-line-in-linq.aspx</link>
            <description>&lt;p&gt;Pretty straight-forward, but a useful snippet of code nonetheless.  &lt;/p&gt; &lt;p&gt;Given this class:&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; AggregateContent
    {
 
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Title { get; set; }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Description  { get; set; }
      

        &lt;span class="kwrd"&gt;public&lt;/span&gt; AggregateContent(&lt;span class="kwrd"&gt;string&lt;/span&gt; Header, &lt;span class="kwrd"&gt;string&lt;/span&gt; Content)
        {
            Title = Header;
            Description = Content;
        }
    }&lt;/pre&gt;
&lt;p&gt;You can use line to create an IEnumerable&amp;lt;AggregateContent&amp;gt; like this:&lt;/p&gt;&lt;pre class="csharpcode"&gt;            IEnumerable&amp;lt;AggregateContent&amp;gt; a = 
                LastNNewsItems.Select(p =&amp;gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; AggregateContent(p.NewsTitle, p.HtmlContent));&lt;/pre&gt;&lt;pre class="csharpcode"&gt; &lt;/pre&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8e587fdb-6596-48ce-9ed6-d7da23c77729" class="wlWriterSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/quick-tip" rel="tag"&gt;quick-tip&lt;/a&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
]]&gt;&lt;/style&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/137819.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay Uttam</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2010/02/05/create-ienumerablelttgt-with-one-line-in-linq.aspx</guid>
            <pubDate>Fri, 05 Feb 2010 21:45:45 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2010/02/05/create-ienumerablelttgt-with-one-line-in-linq.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/137819.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/137819.aspx</trackback:ping>
        </item>
        <item>
            <title>jQuery: Get value of checked checkboxes by name | className</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2010/02/03/jquery-get-value-of-checked-checkboxes-by-name--classname.aspx</link>
            <description>&lt;p&gt;Think this one speaks for itself :) &lt;/p&gt;  &lt;pre class="csharpcode"&gt;    &lt;span class="rem"&gt;//Get via name attribute.  Would be better if you added form ID to selector&lt;/span&gt;

    &lt;span class="kwrd"&gt;var&lt;/span&gt; checkBoxes = $(&lt;span class="str"&gt;"input[name="&lt;/span&gt; + checkBoxName + &lt;span class="str"&gt;"]"&lt;/span&gt;);
        &lt;span class="rem"&gt;//Need to use each or you'll only get the first match&lt;/span&gt;

    $.each(checkBoxes, &lt;span class="kwrd"&gt;function&lt;/span&gt;() {
                &lt;span class="kwrd"&gt;if&lt;/span&gt; ($(&lt;span class="kwrd"&gt;this&lt;/span&gt;).attr(&lt;span class="str"&gt;'checked'&lt;/span&gt;)){
            &lt;span class="rem"&gt;//do stuff&lt;/span&gt;
        }

        });

    &lt;span class="rem"&gt;//Get via class name. Would be better if you added form ID to selector&lt;/span&gt;

    &lt;span class="kwrd"&gt;var&lt;/span&gt; checkBoxes = $(&lt;span class="str"&gt;'.'&lt;/span&gt; + checkBoxClass);
        $.each(checkBoxes, &lt;span class="kwrd"&gt;function&lt;/span&gt;() {
            &lt;span class="kwrd"&gt;if&lt;/span&gt; ($(&lt;span class="kwrd"&gt;this&lt;/span&gt;).attr(&lt;span class="str"&gt;'checked'&lt;/span&gt;)){
            &lt;span class="rem"&gt;//do stuff&lt;/span&gt;
        }
        });&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/137779.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay Uttam</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2010/02/03/jquery-get-value-of-checked-checkboxes-by-name--classname.aspx</guid>
            <pubDate>Wed, 03 Feb 2010 16:50:15 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2010/02/03/jquery-get-value-of-checked-checkboxes-by-name--classname.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/137779.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/137779.aspx</trackback:ping>
        </item>
        <item>
            <title>jQuery AJAX call working in IE but not FF?</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2010/01/21/jquery-ajax-call-working-in-ie-but-not-ff.aspx</link>
            <description>&lt;p&gt;Just ran into this one.  The following is the code I was working with:&lt;/p&gt;&lt;pre class="csharpcode"&gt;$.ajax({
            type: &lt;span class="str"&gt;"GET"&lt;/span&gt;,
            url: &lt;span class="str"&gt;'http://services.somewhere.com/MethodName'&lt;/span&gt;,
            data: { &lt;span class="str"&gt;'param1'&lt;/span&gt;:&lt;span class="str"&gt;'something'&lt;/span&gt;, &lt;span class="str"&gt;'param2'&lt;/span&gt;: &lt;span class="str"&gt;'somethingElse'&lt;/span&gt; },
            cache: &lt;span class="kwrd"&gt;false&lt;/span&gt;,
            dataType: &lt;span class="str"&gt;'json'&lt;/span&gt;,
            success: &lt;span class="kwrd"&gt;function&lt;/span&gt;(view) {
                alert(&lt;span class="str"&gt;'success'&lt;/span&gt;);
            },
            error: &lt;span class="kwrd"&gt;function&lt;/span&gt;(xhr, ajaxOptions, thrownError) {
                alert(xhr.status);
                alert(xhr.responseText);
                alert(xhr.statusText);
            }
        });&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
]]&gt;&lt;/style&gt;

&lt;p&gt;This worked in IE 8, but not FF 3.5.  The strange part, though, was that the xhr object in my error function didn't even contain &lt;em&gt;anything &lt;/em&gt;in FF, whereas when I intentionally made the service fail in my IE testing my error object contained the server response.  Turns out the fix was changing dataType to 'jsonp' instead of 'json'.  I also added the contentType based on &lt;a href="http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/" target="_blank"&gt;this post&lt;/a&gt;.  &lt;a href="http://en.wikipedia.org/wiki/JSON#JSONP" target="_blank"&gt;More on jsonp...&lt;/a&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;$.ajax({
            type: &lt;span class="str"&gt;"GET"&lt;/span&gt;,
            url: &lt;span class="str"&gt;'http://services.somewhere.com/MethodName'&lt;/span&gt;,
            data: { &lt;span class="str"&gt;'param1'&lt;/span&gt;:&lt;span class="str"&gt;'something'&lt;/span&gt;, &lt;span class="str"&gt;'param2'&lt;/span&gt;: &lt;span class="str"&gt;'somethingElse'&lt;/span&gt; },
            cache: &lt;span class="kwrd"&gt;false&lt;/span&gt;,
            dataType: &lt;span class="str"&gt;'jsonp'&lt;/span&gt;,
            contentType: &lt;span class="str"&gt;"application/json; charset=utf-8"&lt;/span&gt;,
            success: function(view) {
                alert(&lt;span class="str"&gt;'success'&lt;/span&gt;);
            },
            error: function(xhr, ajaxOptions, thrownError) {
                alert(xhr.status);
                alert(xhr.responseText);
                alert(xhr.statusText);
            }
        });&lt;/pre&gt;&lt;pre class="csharpcode"&gt; &lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
]]&gt;&lt;/style&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/137574.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay Uttam</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2010/01/21/jquery-ajax-call-working-in-ie-but-not-ff.aspx</guid>
            <pubDate>Thu, 21 Jan 2010 20:43:31 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2010/01/21/jquery-ajax-call-working-in-ie-but-not-ff.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/137574.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/137574.aspx</trackback:ping>
        </item>
        <item>
            <title>Searching TFS for code changes</title>
            <category>Misc</category>
            <link>http://geekswithblogs.net/SanjayU/archive/2010/01/19/searching-tfs-for-code-changes.aspx</link>
            <description>&lt;p&gt;Eventually you're going to need to search their source-control for latest changes given some parameters.  I recently came across a couple of handy ways to do this, using TFS Powertools (and Powershell).  &lt;/p&gt;  &lt;p&gt;First, ensure you have the latest version of &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FBD14EEA-781F-45A1-8C46-9F6BA2F68BF0&amp;amp;displaylang=en" target="_blank"&gt;TFS Powertools&lt;/a&gt; installed.  &lt;/p&gt;  &lt;p&gt;Also ensure you have included Powershell CmdLets when you install (or make sure this option was enabled if you've already got TFS Powertools installed)&lt;/p&gt;  &lt;p&gt;To search TFS via the command line, fire up the Powershell window and execute the following command:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;PS C:\SanjayU\&amp;gt; Get-TfsitemHistory &lt;span class="str"&gt;"$/SomeProject/SomeBranch/1.0/"&lt;/span&gt; -Version &lt;span class="str"&gt;"D1/1/10~D1/15/10"&lt;/span&gt; -Re
curse -server http://YourTfsServer:8080&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;This would get all changes from January 1st, 2010 to January 15th, 2010 in the SomeProject/SomeBranch/1.0 directory on our TFS server.  &lt;/p&gt;

&lt;p&gt;Alternatively, you can execute the following command which will provide you a GUI to conduct similar searches..&lt;/p&gt;

&lt;pre class="csharpcode"&gt;PS C:\SanjayU\&amp;gt; tfpt searchcs&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;Definitely handy.  &lt;/p&gt;

&lt;p&gt;___&lt;/p&gt;

&lt;p&gt;Sources &amp;amp; further reading&lt;/p&gt;

&lt;p&gt;&lt;a title="http://blog.hackedbrain.com/archive/2009/04/01/6166.aspx" href="http://blog.hackedbrain.com/archive/2009/04/01/6166.aspx"&gt;http://blog.hackedbrain.com/archive/2009/04/01/6166.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/z51z7zy0.aspx" href="http://msdn.microsoft.com/en-us/library/z51z7zy0.aspx"&gt;http://msdn.microsoft.com/en-us/library/z51z7zy0.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/bb385992.aspx" href="http://msdn.microsoft.com/en-us/library/bb385992.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb385992.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Installation of TFS PowerTools:&lt;/p&gt;

&lt;p&gt;&lt;a title="http://dotnet.org.za/willy/archive/2008/11/09/visual-studio-team-system-2008-team-foundation-server-power-tools-october-2008-release.aspx" href="http://dotnet.org.za/willy/archive/2008/11/09/visual-studio-team-system-2008-team-foundation-server-power-tools-october-2008-release.aspx"&gt;http://dotnet.org.za/willy/archive/2008/11/09/visual-studio-team-system-2008-team-foundation-server-power-tools-october-2008-release.aspx&lt;/a&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ac2f36b9-42ee-41cc-adb9-d7a38357c1eb" class="wlWriterSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Quick-tip" rel="tag"&gt;Quick-tip&lt;/a&gt;&lt;/div&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/137551.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay Uttam</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2010/01/19/searching-tfs-for-code-changes.aspx</guid>
            <pubDate>Tue, 19 Jan 2010 23:14:58 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2010/01/19/searching-tfs-for-code-changes.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/137551.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/137551.aspx</trackback:ping>
        </item>
        <item>
            <title>Making your code instantly readable...</title>
            <category>C#</category>
            <category>Patterns &amp; Practices</category>
            <link>http://geekswithblogs.net/SanjayU/archive/2010/01/08/making-your-code-instantly-readable.aspx</link>
            <description>&lt;p&gt;I'm currently reading the second edition of _Code Complete_ from cover-to-cover.  More on that later, I'm sure - but for now I'll just say that you should read this right now if you haven't read it already.  This is one of those books that you should really just leave by your dev machine. &lt;/p&gt;  &lt;p&gt;In any case, Steve McConnell mentions the importance of making code readable throughout the book.  This is far from profound, yet in practice I don't see it done very much.  Frankly, if you examine your coding practices from a cost-benefit perspective, you'd be hard-pressed to find an instance where this doesn't make sense.  It takes so little effort to make your code readable.  It could even reduce the likelihood of creating bugs in your code. &lt;/p&gt;  &lt;p&gt;The below is a less-than-ideal, contrived example - I think it communicates the point, though.  What looks better, this...&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnLoad(EventArgs e)
{
    &lt;span class="kwrd"&gt;int&lt;/span&gt; NumberOfVacationDays = 0;

    &lt;span class="kwrd"&gt;if&lt;/span&gt;(Employee.Type == EmployeeType.FullTime)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (Employee.Level == EmployeeLevel.Professional)
        {
            NumberOfVacationDays = 10;
        }
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (Employee.Level == EmployeeLevel.Executive)
        {
            NumberOfVacationDays = 20;
        }
    }
    
    &lt;span class="kwrd"&gt;if&lt;/span&gt;(Employee.Type == Employee.PartTime)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt;(Employee.ExemptStatus == ExemptStatus.Exempt)
        {        
            NumberOfVacationDays = 0;
        }
        &lt;span class="kwrd"&gt;if&lt;/span&gt;(Employee.ExemptStatus == ExemptStatus.NonExempt)
        {        
            NumberOfVacationDays = 0;
        }
    }
}&lt;style type="text/css"&gt;&lt;![CDATA[csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
]]&gt;&lt;/style&gt;&lt;/pre&gt;

&lt;p&gt;or...&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnLoad(EventArgs e)
{
    EmployeeType employeeType = New EmployeeType();
    &lt;span class="kwrd"&gt;int&lt;/span&gt; NumberOfVacationDays = GetVacationByEmployeeType(employeeType);
}

&lt;span class="rem"&gt;//This method doesn't need to be in the same class...only for demo purposes&lt;/span&gt;
&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; GetVacationByEmployeeType(employeeType)
{...} &lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;Okay.  You're either thinking one or more of the following right now: &lt;/p&gt;

&lt;p&gt;Q. So what?  You didn't reduce any of the code.  What does this accomplish? &lt;/p&gt;

&lt;p&gt;A. You're right.  We haven't reduced code.  In fact, we have done the exact opposite.  We have reduced the perceived complexity though, because when Sam from down the hall needs to add some functionality in 4 months he'll know exactly what is being done without having to _mentally parse_ any code.  Yes, of course he can read a few simple if blocks and deduce what's happening - there just isn't a reason to do this. &lt;/p&gt;

&lt;p&gt;Q. You're adding more code and this could make the program perform worse. &lt;/p&gt;

&lt;p&gt;A. In the &lt;em&gt;most performance critical application &lt;/em&gt;(Hello NASA employees), maybe.  For 99.9999% of us, you &lt;em&gt;are not going to see improvements by reducing method calls&lt;/em&gt;.  We're doing the logic somewhere and adding a method to the stack really won't change your life.  I can prove it on an abacus.  &lt;/p&gt;

&lt;p&gt;Q. Okay, that's more readable...do I gain any other benefits? 
  &lt;br /&gt;A. Yes.  You gain the gratification of knowing you've done something correctly.  You really shouldn't have business rules/logic embedded in your event.  What happens when you want to use the same logic in some other class/method/file/spacecraft?  You're out of luck.  It's easy to never think about this...or assume you'll never need to use this logic anywhere else.  If that's the case, you should part out the logic into its own private, local method.  That way if you ever need to reuse the method you can change the access modifier and move it to a class where it makes a little more sense.  &lt;/p&gt;

&lt;p&gt;As a additional side note, you should &lt;em&gt;never ever&lt;/em&gt; have the business rule evaluation logic [as shown in the first example] in more than one location.  If that's the case, you'll need to make changes all over place when the business rules change.  And trust me, they're going to change. &lt;/p&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/137395.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay Uttam</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2010/01/08/making-your-code-instantly-readable.aspx</guid>
            <pubDate>Fri, 08 Jan 2010 22:20:22 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2010/01/08/making-your-code-instantly-readable.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/137395.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/137395.aspx</trackback:ping>
        </item>
        <item>
            <title>Annoying Error + Semi-Annoying Hunt for Resolution = Pleasant Surprise</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/12/02/annoying-error--semi-annoying-hunt-for-resolution--pleasant-surprise.aspx</link>
            <description>&lt;p&gt;I received the following error yesterday:&lt;/p&gt;  &lt;p&gt;"Unable to start debugging on the web server. An authentication error occurred while communicating with the web server. Please see Help for assistance."&lt;/p&gt;  &lt;p&gt;I tried a fair amount &lt;em&gt;stuff&lt;/em&gt; (technical term) including items outlined on Ryan Farley's &lt;a href="http://ryanfarley.com/blog/archive/2005/08/23/8540.aspx" target="_blank"&gt;post&lt;/a&gt; regarding the message.  What ended up working [for me] was posted by Boaz in the comments of Ryan's blog.  Here is the link to the MSDN fix:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://support.microsoft.com/?kbid=896861#fixitforme" href="http://support.microsoft.com/?kbid=896861#fixitforme"&gt;http://support.microsoft.com/?kbid=896861#fixitforme&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Warning: If you go the "Fix it For Me" route, you'll need to reboot.&lt;/p&gt;  &lt;p&gt;If the above fix doesn't work, take a look at &lt;a href="http://msdn.microsoft.com/en-us/library/aa290100%28VS.71%29.aspx" target="_blank"&gt;this&lt;/a&gt;.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/136651.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay Uttam</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/12/02/annoying-error--semi-annoying-hunt-for-resolution--pleasant-surprise.aspx</guid>
            <pubDate>Wed, 02 Dec 2009 15:23:09 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/12/02/annoying-error--semi-annoying-hunt-for-resolution--pleasant-surprise.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/136651.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/136651.aspx</trackback:ping>
        </item>
        <item>
            <title>Web Application Performance: CSS Data URIs</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/12/01/web-application-performance-css-data-uris.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;Was doing my daily research today and learned a couple of new and interesting things.  A while back, I wrote a post about rendering options using .NET 3.5 SP1's charting component.  I outlined a few of the more conventional/out-of-the-box methods (temporary directory, binary streaming).  I also outlined a lesser-known technique in which you stream binary data to the &lt;em&gt;src &lt;/em&gt;attribute of your &amp;lt;img&amp;gt; tag.  That ends up looking like this...&lt;/font&gt;&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;='&lt;span class="attr"&gt;data:image&lt;/span&gt;/&lt;span class="attr"&gt;png&lt;/span&gt;;&lt;span class="attr"&gt;base64&lt;/span&gt;, &lt;span class="attr"&gt;iVBORw0KGgoAAAA&lt;/span&gt;[&lt;span class="attr"&gt;snip&lt;/span&gt;]; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;&lt;font size="2"&gt;The full post can be found &lt;/font&gt;&lt;a href="http://geekswithblogs.net/SanjayU/archive/2009/06/18/asp.net-charting-rendering-options.aspx" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;In any case, it turns out you can apply a similar/identical technique to your CSS for a performance gain (by way of reducing HTTP requests)....It's really the same exact technique as above.  So, for example, a CSS class may look like this:&lt;/font&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font color="#ff0000"&gt;#some-css-class{background-image:url(data:image/png;base64,iVBORw0KGgoAAAA [snip] )}&lt;/font&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;&lt;font size="2"&gt;This can be &lt;em&gt;very useful&lt;/em&gt; for sites that have a large number of image paths embedded in CSS.  But "How do I convert my existing images?" you ask?  There are a few ways.  In the &lt;/font&gt;&lt;a href="http://geekswithblogs.net/SanjayU/archive/2009/06/18/asp.net-charting-rendering-options.aspx" target="_blank"&gt;&lt;font size="2"&gt;previous post&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; I mentioned how convert a memory stream to its base64 representation.  &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;A quick-and-dirty sample of how to do this from a file that exists on a server/HD would look like this (Update:  Per Petar's comment below, disposing of the FileStream object completely eluded me in my original version of the code sample below.  Updated to use &lt;em&gt;using&lt;/em&gt; instead.)&lt;/font&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; getBase64Image()
{
    &lt;span class="kwrd"&gt;using&lt;/span&gt; (FileStream imageStream = File.OpenRead(&lt;span class="str"&gt;"C:\\temp\\testImage.png"&lt;/span&gt;))
    {
    &lt;span class="kwrd"&gt;byte&lt;/span&gt;[] data = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[imageStream.Length];
    imageStream.Read(data, 0, data.Length);
    &lt;span class="kwrd"&gt;string&lt;/span&gt; binaryRepresenatation = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Concat(&lt;span class="str"&gt;"data:image/png;base64,"&lt;/span&gt;, Convert.ToBase64String(data.ToArray()));
    &lt;span class="rem"&gt;//htmlImgTag looks like this: &amp;lt;img runat="server" id="htmlImgTag" /&amp;gt;&lt;/span&gt;
    htmlImgTag.Src = binaryRepresenatation;
    }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;&lt;font size="2"&gt;Additionally, you can do do one-off conversions of images from your HD or a URL using Hixie's Data URI Kitchen: &lt;/font&gt;&lt;a title="http://software.hixie.ch/utilities/cgi/data/data" href="http://software.hixie.ch/utilities/cgi/data/data"&gt;&lt;font size="2"&gt;http://software.hixie.ch/utilities/cgi/data/data&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Lastly, Nicholas Zakas created the Java based CSSEmbed tool that will do this conversion for you from your CSS files on-the-fly.  I haven't tried it, but have heard good things: &lt;/font&gt;&lt;a title="http://github.com/nzakas/cssembed" href="http://github.com/nzakas/cssembed"&gt;&lt;font size="2"&gt;http://github.com/nzakas/cssembed&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;As always, there are some things to watch out for using this technique.  &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Firstly, data URI are not supported in all browsers...the wiki on Data URIs has some good info: &lt;/font&gt;&lt;a title="http://en.wikipedia.org/wiki/Data_URI_scheme" href="http://en.wikipedia.org/wiki/Data_URI_scheme"&gt;&lt;font size="2"&gt;http://en.wikipedia.org/wiki/Data_URI_scheme&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Second, as described by Rob Flaherty, there are some gotchas to watch out for.  The long and short of it is if you have a data URI that results in an image larger than 32k, it &lt;em&gt;could&lt;/em&gt; negate this performance boost to some extent.  It's best to check out Rob's post on this for more detailed information: &lt;/font&gt;&lt;a title="http://www.ravelrumba.com/blog/css-images-and-data-uris/" href="http://www.ravelrumba.com/blog/css-images-and-data-uris/"&gt;&lt;font size="2"&gt;http://www.ravelrumba.com/blog/css-images-and-data-uris/&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d76ac3e8-450f-4e40-a112-12667acaebcc" class="wlWriterSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/performance" rel="tag"&gt;performance&lt;/a&gt;,&lt;a href="http://technorati.com/tags/quick-tip" rel="tag"&gt;quick-tip&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="1"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="1"&gt;Sources: &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://en.wikipedia.org/wiki/Data_URI_scheme" href="http://en.wikipedia.org/wiki/Data_URI_scheme"&gt;&lt;font size="1"&gt;http://en.wikipedia.org/wiki/Data_URI_scheme&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.ravelrumba.com/blog/css-images-and-data-uris/" href="http://www.ravelrumba.com/blog/css-images-and-data-uris/"&gt;&lt;font size="1"&gt;http://www.ravelrumba.com/blog/css-images-and-data-uris/&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://geekswithblogs.net/SanjayU/archive/2009/06/18/asp.net-charting-rendering-options.aspx" href="http://geekswithblogs.net/SanjayU/archive/2009/06/18/asp.net-charting-rendering-options.aspx"&gt;&lt;font size="1"&gt;http://geekswithblogs.net/SanjayU/archive/2009/06/18/asp.net-charting-rendering-options.aspx&lt;/font&gt;&lt;/a&gt;&lt;font size="1"&gt; :)&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.slideshare.net/stoyan/high-performance-kick-ass-web-apps-javascript-edition" href="http://www.slideshare.net/stoyan/high-performance-kick-ass-web-apps-javascript-edition"&gt;&lt;font size="1"&gt;http://www.slideshare.net/stoyan/high-performance-kick-ass-web-apps-javascript-edition&lt;/font&gt;&lt;/a&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/136647.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/12/01/web-application-performance-css-data-uris.aspx</guid>
            <pubDate>Tue, 01 Dec 2009 21:04:10 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/12/01/web-application-performance-css-data-uris.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/136647.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/136647.aspx</trackback:ping>
        </item>
        <item>
            <title>Error Handling in ASP.NET MVC 1 [Part 2 of 2]</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx</link>
            <description>&lt;p&gt;In the &lt;a href="http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx" target="_blank"&gt;first post&lt;/a&gt; in this series, I provided a little info on the HandleError attribute in MVC 1.  In case you don’t want to flip back, the HandleError attribute can decorate a method or a class and will push your users to a generic errors view provided customErrors is “On” or “RemoteOnly”.  There’s a little more to it, but that’s all the background we need for this post.&lt;/p&gt;  &lt;p&gt;The out-of-the-box HandleError attribute works well, until you’re in a scenario where you need to do more than hide your errors.  Typically, you may want to do some logging or fire-off some alerts.  Now, as luck should have it, I did some searching before writing this up and Danny Tuppeny already has a &lt;a href="http://blog.dantup.me.uk/2009/04/aspnet-mvc-handleerror-attribute-custom.html" target="_blank"&gt;great post&lt;/a&gt; on this very subject…I encourage you to take a peak at his post, as I’ve provided a very high-level, yet functional summary below.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The facts are these…&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;- System.Web.Mvc.Controller contains an OnException method that gets fired when an exception occurs [provided custom errors are On/RemoteOnly in the web.config]&lt;/p&gt;  &lt;p&gt;- The OnException method can easily be overridden, allowing you to either completely change behavior or add behavior (by calling base.OnException)&lt;/p&gt;  &lt;p&gt;- This method will fire &lt;em&gt;&lt;strong&gt;regardless&lt;/strong&gt; of whether your class or method is decorated with HandleError&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;This means that your could will look like this:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web.Mvc;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; MvcErrorHandling.Controllers&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ControllerBase : System.Web.Mvc.Controller&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnException(ExceptionContext filterContext)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;             &lt;span style="color: #008000"&gt;//Do whatever stuff you'd like&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;             DoSomeOtherStuff();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;             &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;             &lt;span style="color: #008000"&gt;//Displays a friendly error, doesn't require HandleError&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             filterContext.ExceptionHandled = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.View(&lt;span style="color: #006080"&gt;"Error"&lt;/span&gt;).ExecuteResult(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ControllerContext);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;             &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;             &lt;span style="color: #008000"&gt;//Displays a friendly error, *requires* HandlError&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;             &lt;span style="color: #008000"&gt;//base.OnException(filterContext);&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; DoSomeOtherStuff() { &lt;span style="color: #008000"&gt;/* brevity */&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;To get the above code to work you’d simply make your controller inherit from ControllerBase.  Of course, you’d likely have additional utility-methods in this class that you’d need in multiple controllers.  &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Lines 17 and 18 can be used to push the user to your error view after you execute the DoSomeOtherStuff() method – this &lt;em&gt;would not require &lt;/em&gt;the HandleError attribute.  Alternatively, you can execute System.Web.Mvc.Controller’s OnException by calling it explicitly as it’s done on line 21.  In this case, the HandleError would be required to push your use down the custom-error path you’ve got configured.  &lt;/p&gt;

&lt;p&gt;And that’s pretty much all there is to centralizing &amp;amp; customizing your error-handling in MVC 1.   &lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fgeekswithblogs.net%2fSanjayU%2farchive%2f2009%2f11%2f09%2ferror-handling-in-asp.net-mvc-1-part-2-of-2.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fgeekswithblogs.net%2fSanjayU%2farchive%2f2009%2f11%2f09%2ferror-handling-in-asp.net-mvc-1-part-2-of-2.aspx" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;span class="sbmLink"&gt;
  &lt;table cellspacing="1" cellpadding="1"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td class="sbmText"&gt;Share this post : &lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to MSDN!" href="http://social.msdn.microsoft.com/en-us/action/create/s/E/?url=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;ttl=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/msdn.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to Expression!" href="http://social.expression.microsoft.com/en-us/action/create/s/E/?url=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;ttl=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/expression.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;;title=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to digg" href="http://digg.com/submit?phase=2&amp;amp;url=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;title=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to dotnetkicks" href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;title=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/CropperCapture154.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to Facebook" href="http://www.facebook.com/sharer.php?u=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;t=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.technet.com/photos/james/images/1765319/original.aspx" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to live" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;title=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to netvouz!" href="http://netvouz.com/action/submitBookmark?url=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;title=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/netvouz4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to reddit!" href="http://reddit.com/submit?url=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;title=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to technorati!" href="http://technorati.com/faves/?add=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;title=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx&amp;amp;t=Error Handling in MVC [2 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /&gt;&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c3f8beaf-a7d3-4f00-9829-b8d38b8df139" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/MVC" rel="tag"&gt;MVC&lt;/a&gt;,&lt;a href="http://technorati.com/tags/c%23" rel="tag"&gt;c#&lt;/a&gt;&lt;/div&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/136166.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx</guid>
            <pubDate>Mon, 09 Nov 2009 23:38:07 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/11/09/error-handling-in-asp.net-mvc-1-part-2-of-2.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/136166.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/136166.aspx</trackback:ping>
        </item>
        <item>
            <title>Error Handling in ASP.NET MVC 1 [Part 1 of 2]</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx</link>
            <description>&lt;p&gt;I’ve been using ASP.NET MVC Release 1 for a bit now, and while it’s definitely not for every application, I happen to like it quite a bit.  There has been a lot of activity on MS-centric blogs regarding MVC, but there are still some really mundane tasks that there could be more information on.  So, this series of posts isn’t going to be anything crazy; it will, however, illustrate what options you have to do centralized error-handling using MVC 1.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;We’ll start at the beginning…&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The System.Web.Mvc.dll comes with the &lt;font color="#0000ff"&gt;HandleErrorAttribute&lt;/font&gt; class, which contains..wait for it…the HandleError attribute.   This information won’t be important until later in this series, but the &lt;font color="#0000ff"&gt;HandleErrorAttribute&lt;/font&gt; class inherits from the &lt;font color="#0000ff"&gt;FilterAttribute&lt;/font&gt; class, and implements the &lt;font color="#0000ff"&gt;IExceptionFilter&lt;/font&gt; interface – the interface requires a method with the following signature.  &lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;virtual&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnException(ExceptionContext filterContext);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This method is really where the brunt of the work is done when you use the provided [HandleError] attribute.  In case you’ve never taken a look using Reflector, this HandleErrorAttribute’s implementation of OnException looks like this:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 281px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;virtual&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnException(ExceptionContext filterContext)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (filterContext == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;          &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color: #006080"&gt;"filterContext"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!filterContext.ExceptionHandled &amp;amp;&amp;amp; filterContext.HttpContext.IsCustomErrorEnabled)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;          Exception innerException = filterContext.Exception;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;          &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ((&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpException(&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, innerException).GetHttpCode() == 500) &amp;amp;&amp;amp; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ExceptionType.IsInstanceOfType(innerException))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;          {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; controllerName = (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;) filterContext.RouteData.Values[&lt;span style="color: #006080"&gt;"controller"&lt;/span&gt;];&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; actionName = (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;) filterContext.RouteData.Values[&lt;span style="color: #006080"&gt;"action"&lt;/span&gt;];&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              HandleErrorInfo model = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HandleErrorInfo(filterContext.Exception, controllerName, actionName);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              ViewResult result = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ViewResult();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              result.ViewName = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.View;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              result.MasterName = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Master;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              result.ViewData = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ViewDataDictionary&amp;lt;HandleErrorInfo&amp;gt;(model);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              result.TempData = filterContext.Controller.TempData;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              filterContext.Result = result;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              filterContext.ExceptionHandled = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              filterContext.HttpContext.Response.Clear();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              filterContext.HttpContext.Response.StatusCode = 500;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              filterContext.HttpContext.Response.TrySkipIisCustomErrors = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;          }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Essentially, you’re grabbing some information from the ExceptionContext, and you’re using the &lt;font color="#0000ff"&gt;HandleErrorInfo&lt;/font&gt; class to pass this information back to your view. &lt;/p&gt;

&lt;p&gt;Using [HandleError] is really as easy as using any other attribute.  You simply decorate your method or class with the attribute and your errors will be pushed to the default view for errors (Views/Shared/Error.aspx)&lt;/p&gt;

&lt;p&gt;Sample usage of [HandleError]:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; MvcErrorHandling.Controllers&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [HandleError]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; HomeController : Controller&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            { &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ApplicationException(&lt;span style="color: #006080"&gt;"Some error..."&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        //removed...&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, you can provide the HandleError attribute with some arguments to specify a view other than the default error-view, or specify a specific view based on the exception type.  Here’s an example of the usage for that…&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;[HandleError(ExceptionType = &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(ApplicationException), View = &lt;span style="color: #006080"&gt;"AppErrorPage"&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; HomeController : Controller&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        { &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ApplicationException(&lt;span style="color: #006080"&gt;"Some error..."&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    //removed...&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The only other thing you’ll want to make sure you do is ensure your web.config &amp;lt;customErrors&amp;gt; section is configured appropriately.  That is, you’ll want to make sure customErrors mode=”On” to test this out. &lt;/p&gt;

&lt;p&gt;Hope this helps somebody; the next part in this series will demonstrate how to add functionality to the existing OnException method that the &lt;font color="#0000ff"&gt;HandleErrorAttribute&lt;/font&gt; class implements, such as logging.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fgeekswithblogs.net%2fSanjayU%2farchive%2f2009%2f11%2f06%2ferror-handling-in-asp.net-mvc-1-1-of-a-3.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fgeekswithblogs.net%2fSanjayU%2farchive%2f2009%2f11%2f06%2ferror-handling-in-asp.net-mvc-1-1-of-a-3.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;span class="sbmLink"&gt;
  &lt;table cellspacing="1" cellpadding="1"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td class="sbmText"&gt;Share this post : &lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to MSDN!" href="http://social.msdn.microsoft.com/en-us/action/create/s/E/?url=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;ttl=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/msdn.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to Expression!" href="http://social.expression.microsoft.com/en-us/action/create/s/E/?url=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;ttl=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/expression.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;;title=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to digg" href="http://digg.com/submit?phase=2&amp;amp;url=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;title=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to dotnetkicks" href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;title=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/CropperCapture154.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to Facebook" href="http://www.facebook.com/sharer.php?u=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;t=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.technet.com/photos/james/images/1765319/original.aspx" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to live" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;title=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to netvouz!" href="http://netvouz.com/action/submitBookmark?url=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;title=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/netvouz4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to reddit!" href="http://reddit.com/submit?url=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;title=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to technorati!" href="http://technorati.com/faves/?add=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;title=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx&amp;amp;t=Error Handling in MVC 1 [1 of 2]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /&gt;&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;

  &lt;p&gt;&lt;/p&gt;

  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6a35ce79-8eb3-46ae-b767-160eefe02173" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/mvc" rel="tag"&gt;mvc&lt;/a&gt;,&lt;a href="http://technorati.com/tags/c%23" rel="tag"&gt;c#&lt;/a&gt;&lt;/div&gt;

  &lt;p&gt;&lt;/p&gt;
&lt;/span&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/136069.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx</guid>
            <pubDate>Fri, 06 Nov 2009 22:08:54 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/11/06/error-handling-in-asp.net-mvc-1-1-of-a-3.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/136069.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/136069.aspx</trackback:ping>
        </item>
        <item>
            <title>Adventures in WF 3.0/3.5</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/10/22/adventures-in-wf-3.03.5.aspx</link>
            <description>&lt;p&gt;Until redesign of WF 4.0 is completed &amp;amp; released, I’m going to have to put up with this.  I’ve been working some WF stuff the past few days.  One of the &lt;strong&gt;very&lt;/strong&gt; annoying things about working with the VS designer environment is, well, frankly – the designer.  It’s entirely inconsistent.  Sometimes, when I need to add a normal property (not a dependency property) – doing things the normal way gets me there.  In other words, I add this code to the activity code:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; MyProperty { get; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;and in the designer (right click activity &amp;gt; properties &amp;gt; under “Misc”), I see what I’m supposed to see (umm..right? I’m supposed to see this??)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/SanjayU/WindowsLiveWriter/AdventuresinWF3.03.5_F37D/WFDesignerSupposedToSee_1.png" rel="lightbox"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WFDesignerSupposedToSee" border="0" alt="WFDesignerSupposedToSee" src="http://geekswithblogs.net/images/geekswithblogs_net/SanjayU/WindowsLiveWriter/AdventuresinWF3.03.5_F37D/WFDesignerSupposedToSee_thumb_1.png" width="298" height="25" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;…and everything is right in the world.  Then, 10 minutes you take the identical steps, only with a new property and to your amazement, absolutely nothing happens and you’re left wondering if someone killed a butterfly in a rainforest or something.  Well, I have no idea what happened…but I can tell you that a restart of the IDE is what works for me.  Yep, that’s right…it’s the old Windows 98 solution to things.  Try it.&lt;/p&gt;

&lt;p&gt;Now, the above scenario was with a “normal” property – not a dependency property.  Well, turns out the same thing can happen with dependency properties – which I was fortunate enough to have experienced yesterday.  I would assume the above restart-the-ide “solution” would work for that, as well.  In case it doesn’t, though, it turns out you can actually access dependency properties by doing this…It’s not that pretty – but it definitely works.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;someLocalVarFoo = ((SourceNamespace.SourceClassName)&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GetActivityByName(&lt;span style="color: #006080"&gt;"ActivityName"&lt;/span&gt;)).PropertyName;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/135660.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/10/22/adventures-in-wf-3.03.5.aspx</guid>
            <pubDate>Thu, 22 Oct 2009 21:18:59 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/10/22/adventures-in-wf-3.03.5.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/135660.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/135660.aspx</trackback:ping>
        </item>
        <item>
            <title>Get the index of a given item using LINQ [quick-tip]</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/10/15/quick-tip--get-the-index-of-a-given-using.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: Please see first comment to do this the "safe" way...&lt;/p&gt;
&lt;p&gt;It took a bit for me to get comfortable enough with LINQ-to-objects to write ‘queries’ off the top of my head…but once you’re used to it you realize it’s much more concise, easier to interpret/read, and well..it’s less code.  Here are some real quick examples…&lt;/p&gt;
&lt;p&gt;This first example selects the string array value as well as its position from the someItems array.  Note, the user of new{} creates a new generic type that has the properties ItemName and Position.  I could have called these two properties whatever I pleased, because I’m creating them at query-time.&lt;/p&gt;
&lt;div style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;" id="codeSnippet"&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;[] someItems = { &lt;span style="color: rgb(0, 96, 128);"&gt;"cat"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"dog"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"purple elephant"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"unicorn"&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
 &lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
var selectedItems = someItems.Select((item, index) =&amp;gt; &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
{&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
    ItemName = item,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
    Position = index&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
});&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;After you run this, selectedItems will look like this….&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/SanjayU/WindowsLiveWriter/QuickTipGettheindexofagivenusingLINQ_F094/selItems_1.png" rel="lightbox"&gt;&lt;img height="134" border="0" width="549" style="border-width: 0px; display: inline;" title="selItems" alt="selItems" src="http://geekswithblogs.net/images/geekswithblogs_net/SanjayU/WindowsLiveWriter/QuickTipGettheindexofagivenusingLINQ_F094/selItems_thumb_1.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;And if you needed to just get the position as an int to use that for some other logic, your code may look like this..&lt;/p&gt;
&lt;div style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;" id="codeSnippet"&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; firstItem = someItems.Select((item, index) =&amp;gt; &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
{&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
    ItemName = item,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
    Position = index&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
}).Where(i =&amp;gt; i.ItemName == &lt;span style="color: rgb(0, 96, 128);"&gt;"purple elephant"&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
  .First()&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;
  .Position;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;In which case, firstItem would equal 2.  Naturally, this is only the beginning of what LINQ to objects can do for you – but it definitely illustrates how LINQ can ease your daily coding.&lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; display: inline; float: none;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f126d303-52a4-4de1-ac7b-d42e5e6e469a" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/C%23" rel="tag"&gt;C#&lt;/a&gt;,&lt;a href="http://technorati.com/tags/LINQ" rel="tag"&gt;LINQ&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET" rel="tag"&gt;.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/quick-tip" rel="tag"&gt;quick-tip&lt;/a&gt;&lt;/div&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/135486.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay Uttam</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/10/15/quick-tip--get-the-index-of-a-given-using.aspx</guid>
            <pubDate>Thu, 15 Oct 2009 21:06:35 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/10/15/quick-tip--get-the-index-of-a-given-using.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/135486.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/135486.aspx</trackback:ping>
        </item>
        <item>
            <title>Returning values from your LINQ queries [quick tip]</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx</link>
            <description>&lt;p&gt;Just a quick tip that I found handy while doing some writing yesterday; chances are if you’ve played with LINQ you probably wrote something like this…&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var outputString = from s&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; inputString&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; s.Length &amp;gt; 1&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   select s;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;//Do some stuff with outputString &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; your method...&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Code like the above will work perfectly well if what you’re going to work with your implicit variable, outputString, within the body of the same method.  But, as it stands, you can’t return outputString, or any implicit variable from your method.  Try it, I dare you.  At this point, you’re probably thinking “Wait, can’t I just do a outputString.ToList() or .ToArray() and return that?  Yes – you can.  The catch with doing that, though, is that your LINQ expression is going to be evaluated right there and then.  This might be fine for you, or it might not – but you should be aware of the &lt;a href="http://msdn.microsoft.com/en-us/vcsharp/aa336751.aspx#Deferred" target="_blank"&gt;deferred query execution model&lt;/a&gt; that LINQ embraces.  &lt;/p&gt;

&lt;p&gt;In any case, the easy way out of this assuming you’d prefer to defer execution until you enumerate is actually very straightforward….You can simply return an IEnumerable&amp;lt;T&amp;gt;.  So, something like…&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; IEnumerable&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; DoLinqStuff(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] inputString)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;//You can do this and return an IEnumerable&amp;lt;string&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    IEnumerable&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; outputString =  from s&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                                        &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; inputString&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                                        &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; s.Length &amp;gt; 1&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                                        select s;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; outputString;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;That way, you can do the following to leverage your LINQ expression in an external method while leaving the deferred execution model in-tact…&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;//Remember this isn't evaluated yet...&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;IEnumerable&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; myReturnedStuff = DoLinqStuff(myStrings);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;//It's getting evaluated now...&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; s &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; myReturnedStuff) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    Console.WriteLine(s);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Or if you want to be a bit more concise about it…&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;//Same thing but slightly less code...&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; s &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; DoLinqStuff(myStrings)){&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    Console.WriteLine(s);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Okay, so it wasn’t exactly rocket-science but I figure it may be helpful.  &lt;/p&gt;

&lt;p&gt;
  &lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fitscodeinhere.com%2fSanjayU%2farchive%2f2009%2f09%2f11%2freturning-values-from-your-linq-queries-quick-tip.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fitscodeinhere.com%2fSanjayU%2farchive%2f2009%2f09%2f11%2freturning-values-from-your-linq-queries-quick-tip.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;
&lt;span class="sbmLink"&gt;
  &lt;table cellspacing="1" cellpadding="1"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td class="sbmText"&gt;Share this post : &lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to MSDN!" href="http://social.msdn.microsoft.com/en-us/action/create/s/E/?url=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;ttl=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/msdn.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to Expression!" href="http://social.expression.microsoft.com/en-us/action/create/s/E/?url=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;ttl=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/expression.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;;title=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to digg" href="http://digg.com/submit?phase=2&amp;amp;url=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;title=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to dotnetkicks" href="http://www.dotnetkicks.com/kick/?url=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;title=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/CropperCapture154.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to Facebook" href="http://www.facebook.com/sharer.php?u=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;t=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.technet.com/photos/james/images/1765319/original.aspx" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to live" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;title=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to netvouz!" href="http://netvouz.com/action/submitBookmark?url=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;title=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/netvouz4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to reddit!" href="http://reddit.com/submit?url=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;title=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to technorati!" href="http://technorati.com/faves/?add=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;title=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /&gt;&lt;/a&gt;&lt;/td&gt;

        &lt;td&gt;&lt;a title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://itscodeinhere.com/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx&amp;amp;t=Returning values from your LINQ queries [quick tip]" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /&gt;&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;

  &lt;p&gt; &lt;/p&gt;

  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:10e01d10-5cfa-4518-b44b-a4a10a75e9a0" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/C%23" rel="tag"&gt;C#&lt;/a&gt;,&lt;a href="http://technorati.com/tags/LINQ" rel="tag"&gt;LINQ&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET" rel="tag"&gt;.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/quick-tip" rel="tag"&gt;quick-tip&lt;/a&gt;&lt;/div&gt;
&lt;/span&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/134776.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx</guid>
            <pubDate>Fri, 11 Sep 2009 21:09:45 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/09/11/returning-values-from-your-linq-queries-quick-tip.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/134776.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/134776.aspx</trackback:ping>
        </item>
        <item>
            <title>If you are thinking about using Windows Work-Flow&amp;hellip;you should know&amp;hellip;</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx</link>
            <description>&lt;p&gt;That MS decided to totally blow it up in .NET 4.0. (&lt;a href="http://weblogs.asp.net/pgielens/archive/2008/10/27/windows-workflow-4-0-is-build-from-the-ground-up.aspx" target="_blank"&gt;weblogs.asp.net link&lt;/a&gt;, &lt;a href="http://stackoverflow.com/questions/932312/have-microsoft-rewritten-windows-workflow-foundation-in-net-4-0" target="_blank"&gt;S/O link&lt;/a&gt;).  Yes, that’s right, they are totally re-writing WF 4.0  from the ground-up.  As the first link states, this could be for any number of reasons including lack of adoption and the perception that WF is just too complex – which I happen to agree with.  3.0/3.5 workflows will still work, but only on the 3.0 runtime.  &lt;/p&gt;  &lt;p&gt;On the one hand, I have to give some credit to MS for basically saying “Hey guys, we effed up and we’re gonna scrap this…”, and yet, on the other I have to assume it’s a little embarrassing to have to do something like this.  &lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/SanjayU/WindowsLiveWriter/IfyouarethinkingaboutusingWindowsWorkFlo_C383/WebTV.jpg" rel="lightbox"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="WebTV" border="0" alt="WebTV" align="left" src="http://geekswithblogs.net/images/geekswithblogs_net/SanjayU/WindowsLiveWriter/IfyouarethinkingaboutusingWindowsWorkFlo_C383/WebTV_thumb.jpg" width="184" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;BTW, Is this old news?  How did I totally miss the memo on this? &lt;/p&gt;  &lt;p&gt; &lt;/p&gt; &lt;span class="sbmLink"&gt;   &lt;table cellspacing="1" cellpadding="1"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td class="sbmText"&gt;Share this post : &lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to MSDN!" href="http://social.msdn.microsoft.com/en-us/action/create/s/E/?url=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;ttl=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/msdn.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to Expression!" href="http://social.expression.microsoft.com/en-us/action/create/s/E/?url=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;ttl=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/expression.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;;title=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to digg" href="http://digg.com/submit?phase=2&amp;amp;url=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;title=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to dotnetkicks" href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;title=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/CropperCapture154.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to Facebook" href="http://www.facebook.com/sharer.php?u=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;t=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.technet.com/photos/james/images/1765319/original.aspx" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to live" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;title=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to netvouz!" href="http://netvouz.com/action/submitBookmark?url=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;title=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/netvouz4.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to reddit!" href="http://reddit.com/submit?url=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;title=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to technorati!" href="http://technorati.com/faves/?add=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;title=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx&amp;amp;t=If you're thinking about using Windows Work-flow...you should know..." target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /&gt;&lt;/a&gt;&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt;    &lt;p&gt; &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ec4a6413-f002-4a67-a52b-da2f5535b5d5" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Workflow" rel="tag"&gt;Workflow&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET" rel="tag"&gt;.NET&lt;/a&gt;&lt;/div&gt; &lt;/span&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/134239.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx</guid>
            <pubDate>Fri, 21 Aug 2009 17:54:14 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/08/21/if-you-are-thinking-about-using-windows-work-flowhellipyou-should-knowhellip.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/134239.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/134239.aspx</trackback:ping>
        </item>
        <item>
            <title>Surprising jQuery Performance Tip</title>
            <link>http://geekswithblogs.net/SanjayU/archive/2009/08/21/surprising-jquery-performance-tip.aspx</link>
            <description>&lt;p&gt;Was doing some research this morning, as usual, and came across a post from Giulio Bai on jQuery performance tips.  A lot of his tips are things I’ve heard elsewhere (no offense!), but one that I haven’t seen anywhere and for some reason surprised me is that using a the JavaScript provided for() loop is considerably faster than using jQuery’s each() function.  In fact, it can be several orders of magnitude faster depending on what you’re doing.  Interesting.  &lt;/p&gt;  &lt;p&gt;&lt;a href="http://net.tutsplus.com/tutorials/javascript-ajax/10-ways-to-instantly-increase-your-jquery-performance/" target="_blank"&gt;Link to his post&lt;/a&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a0f2836b-bddc-4f67-ac9a-5a62ec6a72ca" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/jQuery" rel="tag"&gt;jQuery&lt;/a&gt;,&lt;a href="http://technorati.com/tags/performance" rel="tag"&gt;performance&lt;/a&gt;&lt;/div&gt; &lt;img src="http://geekswithblogs.net/SanjayU/aggbug/134237.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sanjay</dc:creator>
            <guid>http://geekswithblogs.net/SanjayU/archive/2009/08/21/surprising-jquery-performance-tip.aspx</guid>
            <pubDate>Fri, 21 Aug 2009 16:28:15 GMT</pubDate>
            <comments>http://geekswithblogs.net/SanjayU/archive/2009/08/21/surprising-jquery-performance-tip.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SanjayU/comments/commentRss/134237.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SanjayU/services/trackbacks/134237.aspx</trackback:ping>
        </item>
    </channel>
</rss>

