<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET Debugging : Exceptions</title><link>http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx</link><description>Tags: Exceptions</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Azure: There is not enough space on the disk</title><link>http://blogs.msdn.com/tom/archive/2009/12/04/azure-there-is-not-enough-space-on-the-disk.aspx</link><pubDate>Fri, 04 Dec 2009 16:55:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9932613</guid><dc:creator>Tom</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/tom/comments/9932613.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=9932613</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=9932613</wfw:comment><description>&lt;h3&gt;Problem&lt;/h3&gt;  &lt;p&gt;There may be some times where you will see this message when developing an application for Windows Azure.&amp;#160; The message will look like:&lt;/p&gt;  &lt;pre class="debug"&gt;There is not enough space on the disk.
Description: An unhandled exception occurred during the execution &lt;br /&gt;of the current web request. Please review the stack trace for more &lt;br /&gt;information about the error and where it originated in the code. 

Exception Details: System.IO.IOException: There is not enough &lt;br /&gt;space on the disk.


Source Error: 
An unhandled exception was generated during the execution of the &lt;br /&gt;current web request. Information regarding the origin and location &lt;br /&gt;of the exception can be identified using the exception stack trace &lt;br /&gt;below. 

Stack Trace: 
  
[IOException: There is not enough space on the disk.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10546789
   System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) +10351324
   System.Web.TempFile.AddBytes(Byte[] data, Int32 offset, Int32 length) +26
   System.Web.HttpRawUploadedContent.AddBytes(Byte[] data, Int32 offset, Int32 length) +327
   System.Web.HttpRequest.GetEntireRawContent() +515
   System.Web.HttpRequest.GetMultipartContent() +72
   System.Web.HttpRequest.FillInFormCollection() +248
   System.Web.HttpRequest.get_Form() +79
   System.Web.HttpRequest.get_HasForm() +73
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +54
   System.Web.UI.Page.DeterminePostBackMode() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +268&lt;/pre&gt;

&lt;p&gt;The typical situation where you will see this is if you are using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx"&gt;ASP.NET FileUpload control&lt;/a&gt; to let users upload files.&lt;/p&gt;

&lt;p&gt;If the file they try to upload exceeds 100 MB, it will error with this message.&lt;/p&gt;

&lt;h3&gt;Resolution&lt;/h3&gt;

&lt;p&gt;There are a few ways that you can work around this issue.&amp;#160; The best solution would be to use Silverlight to handle the upload instead of the ASP.NET FileUpload control.&amp;#160; By using Silverlight, you can have the client directly upload the file to blob storage and reduce how many places the file gets copied.&lt;/p&gt;

&lt;p&gt;There are also some 3rd party controls that you can use to do this as well.&lt;/p&gt;

&lt;h3&gt;More Information&lt;/h3&gt;

&lt;p&gt;The problem with the ASP.NET FileUpload control is that it writes the file to a temp folder during upload.&amp;#160; The folder that is used in Windows Azure is limited to 100 MB so if you try to write something larger then that, it will fail.&lt;/p&gt;

&lt;p&gt;I haven’t tested this, but if you have multiple users uploading data at the same time, you could see the same problem.&amp;#160; For example, if 15 users all upload a 10 MB file at the same time, the temp folder will probably fill up and give the same error.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Note: there is a setting that you may be temped to use which is the tempDirectory attribute off the &lt;a href="http://msdn.microsoft.com/en-us/library/s10awwz0.aspx"&gt;compilation element&lt;/a&gt;.&amp;#160; If you try to set this to anything, it will cause your Web Role to not start up.&lt;/p&gt;
&lt;/blockquote&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px; padding:0px 0px 0px 0px;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;
&lt;/script&gt;
&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9932613" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category><category domain="http://blogs.msdn.com/tom/archive/tags/Azure/default.aspx">Azure</category><category domain="http://blogs.msdn.com/tom/archive/tags/Windows+Azure/default.aspx">Windows Azure</category></item><item><title>Logging modules for ASP.NET (MVC) and also for Windows Azure</title><link>http://blogs.msdn.com/tom/archive/2009/04/24/logging-modules-for-asp-net-mvc-and-also-for-windows-azure.aspx</link><pubDate>Fri, 24 Apr 2009 17:07:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9566755</guid><dc:creator>Tom</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/tom/comments/9566755.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=9566755</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=9566755</wfw:comment><description>&lt;p&gt;I was just reading through Scott Hanselman’s &lt;a href="http://www.hanselman.com/blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx"&gt;post&lt;/a&gt; about ELMAH and this sounds like a great idea.&amp;#160; Getting a easy to consume report of all of your exceptions is a wonderful thing, especially when you add in that you can get it as an RSS feed, an email or a web site.&amp;#160; You can check out &lt;a title="ELMAH" href="http://code.google.com/p/elmah/"&gt;ELMAH&lt;/a&gt; or read through his post to get a lot of details on it.&lt;/p&gt;  &lt;p&gt;The web site looks like this:&lt;/p&gt;  &lt;p&gt;&lt;img src="http://elmah.googlecode.com/svn/wiki/homeshot.png" /&gt;&lt;/p&gt;  &lt;p&gt;This also got me thinking about Windows Azure and some of the logging that has been done already for that.&amp;#160; So I wanted to highlight one of the projects here and talk about what it does.&amp;#160; It is called &lt;a href="http://azuremonitor.codeplex.com/"&gt;Azure Application Monitor&lt;/a&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;This allows you to see how much time and memory your instance is using.&amp;#160; After you integrate this into your application, you will get a report like:&lt;/p&gt;  &lt;p&gt;&lt;img alt="AzureMonitor.jpg" src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=AzureMonitor&amp;amp;DownloadId=63081" /&gt;&lt;/p&gt;  &lt;p&gt;It is easy to add this to your application.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://azuremonitor.codeplex.com/Release/ProjectReleases.aspx"&gt;Download&lt;/a&gt; the application &lt;/li&gt;    &lt;li&gt;Add the following line to your code.&amp;#160; If you are adding it to a WebRole, add it in the Page_PreRender() function.&amp;#160; Or in the Start() of a WorkerRole, changing it to WorkerRole below:      &lt;pre class="csharpcode"&gt;Neudesic.Azure.AzureMonitor.Start(&lt;span class="str"&gt;&amp;quot;AppName&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;WebRole&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
    &lt;style type="text/css"&gt;

.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; }&lt;/style&gt;&lt;/li&gt;

  &lt;li&gt;Be sure you have the TableStorageEndpoint configuration setting configured.&lt;/li&gt;

  &lt;li&gt;Create a PerfCounterUpdateInterval configuration setting and set the value (the value is in ticks (1000 ticks = 1 second)&lt;/li&gt;

  &lt;li&gt;Test and deploy your application&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To view the data, you need to configure the AzureMonitor so that it points to your TableStorageEndpoint&lt;/p&gt;

&lt;p&gt;As for what all it tracks, here is the list:&lt;/p&gt;

&lt;li&gt;Application Name (you supply this in your code)&lt;/li&gt;

&lt;li&gt;Role Name (you supply this in your code)&lt;/li&gt;

&lt;li&gt;Machine Name&lt;/li&gt;

&lt;li&gt;Process ID&lt;/li&gt;

&lt;li&gt;Thread count&lt;/li&gt;

&lt;li&gt;Handle count&lt;/li&gt;

&lt;li&gt;Total processor time&lt;/li&gt;

&lt;li&gt;User processor time&lt;/li&gt;

&lt;li&gt;Private memory size&lt;/li&gt;

&lt;li&gt;Non-paged memory size&lt;/li&gt;

&lt;li&gt;Paged memory size&lt;/li&gt;

&lt;li&gt;Paged system memory size&lt;/li&gt;

&lt;li&gt;Peak paged memory size&lt;/li&gt;

&lt;li&gt;Peak virtual memory size&lt;/li&gt;

&lt;li&gt;Peak working set&lt;/li&gt;

&lt;li&gt;Page file usage&lt;/li&gt;

&lt;li&gt;Peak page file usage&lt;/li&gt;

&lt;li&gt;Non-paged Pool Usage&lt;/li&gt;

&lt;li&gt;Local machine time&lt;/li&gt;

&lt;li&gt;Process local start time&lt;/li&gt;

&lt;p&gt;It is rather easy to add more stuff to this as the code is available from the projects location.&lt;/p&gt;

&lt;p&gt;One a side-note, if you want to see what data you have in your Blobs, Queues and Tables, there is an updated version of &lt;a href="http://azurestorageexplorer.codeplex.com/"&gt;Azure Storage Explorer&lt;/a&gt; available now.&amp;#160; From that site:&lt;/p&gt;

&lt;p&gt;The most current release of Azure Storage Explorer, version 2.0, has several improvements over the original version:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The UI is WPF-based and has Outlook-style navigation.&lt;/li&gt;

  &lt;li&gt;Multiple storage accounts are supported, and you can change your storage account details directly in the tool.&lt;/li&gt;

  &lt;li&gt;In addition to text and byte views of items, blob items that are pictures can be viewed as images.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Azure Storage Explorer 2.0 does not presently allow you to act on storage items. This capability is being considered for a future update.&lt;/p&gt;

&lt;p&gt;Let me know what you think or if you use any other tools for ASP.NET or Windows Azure.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9566755" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category><category domain="http://blogs.msdn.com/tom/archive/tags/MVC/default.aspx">MVC</category><category domain="http://blogs.msdn.com/tom/archive/tags/Azure/default.aspx">Azure</category></item><item><title>Linq exception</title><link>http://blogs.msdn.com/tom/archive/2009/02/25/linq-exception.aspx</link><pubDate>Wed, 25 Feb 2009 18:44:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9444215</guid><dc:creator>Tom</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/tom/comments/9444215.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=9444215</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=9444215</wfw:comment><description>&lt;p&gt;If you have done much programming with Linq and using the relationships between tables, you may come across the following exception:&lt;/p&gt;  &lt;pre&gt;System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException&lt;br /&gt;Operation is not valid due to the current state of the object.&lt;/pre&gt;

&lt;p&gt;This is basically telling you that you have a Relationship between two tables and you are trying to update the link to point to something else.&lt;/p&gt;

&lt;p&gt;In my case, I had something like:&lt;/p&gt;

&lt;p&gt;Table1&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;ID
    &lt;br /&gt;nvarchar&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Table2&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;ID
    &lt;br /&gt;Table1ID&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And I was setting Table1ID, which maps to Table1’s ID to 0.&amp;#160; So if you want to delete an entry, just remove the row in Table1 and Table2 will be updated with the delete.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9444215" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category><category domain="http://blogs.msdn.com/tom/archive/tags/Linq/default.aspx">Linq</category></item><item><title>ASP.NET Tip: Keep hidden files hidden</title><link>http://blogs.msdn.com/tom/archive/2008/08/26/asp-net-tip-keep-hidden-files-hidden.aspx</link><pubDate>Tue, 26 Aug 2008 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8893893</guid><dc:creator>Tom</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/tom/comments/8893893.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=8893893</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=8893893</wfw:comment><description>&lt;p&gt;I have seen a few cases of this so I wanted to let everyone know.&amp;#160; If you install the FrontPage Server Extensions (FPSE) on a web server, it will install some configuration files in a directory under your web site called _vti_cnf.&amp;#160; This folder contains a bunch of files that FPSE use to update files and perform the various tasks that it needs to do.&lt;/p&gt;  &lt;p&gt;The problem comes if that _vti_cnf folder is not marked hidden.&amp;#160; If something keeps that from happening, you can get a few different errors because of it.&amp;#160; The reason is that the aspnet_compiler.exe will try to compile these files since the folder isn't hidden.&amp;#160; There is a web.config file in there that will cause an error like:&lt;/p&gt;  &lt;pre class="code"&gt;Invalid token 'Text' at root level of document.
XML document must contain a root level element.
Data at the root level is invalid. Line 1, position 1.&lt;/pre&gt;

&lt;p&gt;As long as this folder is hidden, the compiler will just skip over it and everything will be fine.&lt;/p&gt;

&lt;p&gt;So the main thing to remember is that if you install FPSE and suddenly start getting errors, checking if that folder is marked hidden is a great place to start.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8893893" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET+Tip/default.aspx">ASP.NET Tip</category></item><item><title>System.IndexOutOfRangeException on a webfarm</title><link>http://blogs.msdn.com/tom/archive/2008/08/13/system-indexoutofrangeexception-on-a-webfarm.aspx</link><pubDate>Wed, 13 Aug 2008 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8852760</guid><dc:creator>Tom</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/tom/comments/8852760.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=8852760</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=8852760</wfw:comment><description>&lt;p&gt;Here is another issue that a customer had that I thought would be helpful to others.&lt;/p&gt;  &lt;h3&gt;Problem&lt;/h3&gt;  &lt;p&gt;The customer said they are getting Exception type: &lt;font color="#ff0000"&gt;System.IndexOutOfRangeException&lt;/font&gt; every minute or so when accessing their web site.&amp;#160; The error looks like:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;pre class="code"&gt;System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at System.Web.UI.WebControls.GridView.LoadControlState(Object savedState)
  at System.Web.UI.Control.LoadControlStateInternal(Object savedStateObj)
  at System.Web.UI.Page.LoadAllState()
  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h3&gt;Resolution&lt;/h3&gt;

&lt;p&gt;This is trying to load ViewState.&amp;#160; ViewState is not necessarily compatible between different versions of the runtime, including service pack changes. A given application, even if distributed in a web farm, must be running on the same exact runtime version on all servers.&amp;#160; This includes the bit-ness.&amp;#160; So they all need to be x86 or x64 as on the same version (Service Pack, etc).&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8852760" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category></item><item><title>Update for viewstate issues</title><link>http://blogs.msdn.com/tom/archive/2008/08/12/update-for-viewstate-issues.aspx</link><pubDate>Tue, 12 Aug 2008 22:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8848789</guid><dc:creator>Tom</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/tom/comments/8848789.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=8848789</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=8848789</wfw:comment><description>&lt;p&gt;So a while ago I posted about how to fix the &lt;a title="http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx" href="http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx"&gt;Validation of viewstate MAC failed error&lt;/a&gt;.&amp;#160; There is some really exciting news that is coming with Visual Studio 2008 Service Pack 1 and .NET Framework 3.5 Service Pack 1.&amp;#160; One of the improvements that they made for this Service Pack is to help alleviate this issue by doing something similar to the code change recommended on my blog.&amp;#160; So the form fields will be written out at the beginning of the form.&lt;/p&gt;  &lt;p&gt;This means that we hopefully won’t get this error any longer from someone clicking on a page before it completely loads.&amp;#160; You can get the Service Pack &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=AB99342F-5D1A-413D-8319-81DA479AB0D7&amp;amp;displaylang=en"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Please let us know if you run into this issue after installing this.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8848789" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category></item><item><title>ASP.NET Tips: DumpAllExceptions output changes</title><link>http://blogs.msdn.com/tom/archive/2008/07/23/asp-net-tips-dumpallexceptions-output-changes.aspx</link><pubDate>Wed, 23 Jul 2008 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8761759</guid><dc:creator>Tom</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/tom/comments/8761759.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=8761759</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=8761759</wfw:comment><description>&lt;P&gt;The first time you run !DumpAllExceptions you will see it print out one full exception for each type of exception that is in the dump.&amp;nbsp; This will include the message and the callstack of the exception.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/ASP.NETTipsDumpAllExceptionsoutputchange_C222/dae-1_2.png" mce_href="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/ASP.NETTipsDumpAllExceptionsoutputchange_C222/dae-1_2.png"&gt;&lt;IMG title=dae-1 style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=234 alt=dae-1 src="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/ASP.NETTipsDumpAllExceptionsoutputchange_C222/dae-1_thumb.png" width=654 border=0 mce_src="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/ASP.NETTipsDumpAllExceptionsoutputchange_C222/dae-1_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Any time after that, if you run the same command, there is a chance that it will print out something different, like:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/ASP.NETTipsDumpAllExceptionsoutputchange_C222/dae-2_2.png" mce_href="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/ASP.NETTipsDumpAllExceptionsoutputchange_C222/dae-2_2.png"&gt;&lt;IMG title=dae-2 style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=234 alt=dae-2 src="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/ASP.NETTipsDumpAllExceptionsoutputchange_C222/dae-2_thumb.png" width=654 border=0 mce_src="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/ASP.NETTipsDumpAllExceptionsoutputchange_C222/dae-2_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;In this example, you can tell they are different because of the InnerException address.&amp;nbsp; Sometimes it will be more obvious then this.&lt;/P&gt;
&lt;P&gt;What is happening here?&amp;nbsp; Well when the list of exceptions is built, the first time through, we will print out one exception that is found in the dump as an example of that type of exception.&amp;nbsp; But the list isn’t sorted yet.&amp;nbsp; When you run it again, we will sort the list and so the one that we pull out to print may be a different one.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is just meant to give you an idea of what these exceptions may be.&amp;nbsp; If you want to really look into them, you can use the -v switch which will print out all of the exceptions instead of grouping them by exception type.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8761759" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/tom/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category></item><item><title>Unable to use Session State Server</title><link>http://blogs.msdn.com/tom/archive/2008/07/14/unable-to-use-session-state-server.aspx</link><pubDate>Mon, 14 Jul 2008 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8718049</guid><dc:creator>Tom</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/tom/comments/8718049.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=8718049</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=8718049</wfw:comment><description>&lt;h3&gt;Issue&lt;/h3&gt;  &lt;p&gt;ASP.NET site running under .NET 2.0 has the following setting in web.config:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&amp;lt;sessionState mode=&amp;quot;StateServer&amp;quot; stateNetworkTimeout=&amp;quot;10&amp;quot; &lt;br /&gt;    cookieless=&amp;quot;false&amp;quot; timeout=&amp;quot;30&amp;quot;/&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;When the application attempts to use the session cache, the following exception is thrown: &lt;/p&gt;

&lt;p&gt;&lt;font color="#ff0000"&gt;HttpException (0x80004005): Unable to use session state server because this version of ASP.NET requires session state server version 2.0 or above.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;This exception occurs the very first time the session cache is used after the application is published to the server, after IIS is restarted, or after the application pool recycles.&amp;#160; Subsequent uses of the session cache after the first exception is thrown do not result in an error.&amp;#160; The session cache continues to work properly until the next application re-publish, IIS restart, or application pool recycle.&lt;/p&gt;

&lt;h3&gt;Cause&lt;/h3&gt;

&lt;p&gt;ASP.NET State server uses HTTP Requests to manage the session state requests.&amp;#160; When sending the response back to the Web application the state server should be including a header&amp;quot;:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre class="code"&gt;X-ASPNet-Version: 2.xxxx header&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The Session State Server reads this header, and checks to see if the major version is &amp;lt; 2, if so it will throw the exception.&lt;/p&gt;

&lt;p&gt;In one case we had with a customer, the header is never being returned.&amp;#160; It is never being returned because in the &amp;lt;httpRuntime&amp;gt; Configuration section they had:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre class="code"&gt;enableVersionHeader = “false”.&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Now, why did this only happen for the first request?&amp;#160; Well, in the very first request to our state server, we check to see if we already know the state server version by comparing to -1. If not, we check the version during the response.&amp;#160; While we are checking the version upon response we set the version to 0 which prevents us from checking the version ever again, since it isn’t -1.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f07%2f14%2funable-to-use-session-state-server.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f07%2f14%2funable-to-use-session-state-server.aspx" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8718049" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category></item><item><title>ASP.NET Tips: What to gather to troubleshoot - part 5 - OutOfMemoryException</title><link>http://blogs.msdn.com/tom/archive/2008/05/19/asp-net-tips-what-to-gather-to-troubleshoot-part-5-outofmemoryexception.aspx</link><pubDate>Mon, 19 May 2008 17:49:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519108</guid><dc:creator>Tom</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/tom/comments/8519108.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=8519108</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=8519108</wfw:comment><description>&lt;p&gt;So we already talked about what to gather when you are experiencing &lt;a href="http://blogs.msdn.com/tom/archive/2008/05/05/asp-net-tips-what-to-gather-to-troubleshoot-part-2-high-memory.aspx"&gt;high memory&lt;/a&gt;.&amp;#160; But what if you are actually getting a System.OutOfMemoryException?&amp;#160; Here is how you capture a dump at the time you are running out of memory.&lt;/p&gt;  &lt;p&gt;The following steps will configure &lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1286"&gt;DebugDiag&lt;/a&gt; to automatically capture the memory dump when the System.OutOfMemoryException occurs.&lt;/p&gt;  &lt;h3&gt;Before the issue occurs&lt;/h3&gt;  &lt;p&gt;A. Download DebugDiag:    &lt;br /&gt;====================&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Install the &lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1286"&gt;Debug Diagnostic tool&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;The default installation location for the package is C:\Program Files\DebugDiag. It can be changed. &lt;/li&gt;    &lt;li&gt;Make sure any other monitoring and debugging tools are not running. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;B. Create a Performance Monitor log:    &lt;br /&gt;==================================== &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Expand &lt;strong&gt;Performance Logs and Alerts&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;Right Click on &lt;strong&gt;Counter Logs&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;Choose &lt;strong&gt;New Log Settings...&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;Enter a descriptive name &lt;/li&gt;    &lt;li&gt;Note the log file location for later (or go to the &lt;strong&gt;Log Files&lt;/strong&gt; tab and change the location) &lt;/li&gt;    &lt;li&gt;Click the &lt;strong&gt;Add&lt;/strong&gt; button &lt;/li&gt;    &lt;li&gt;Click the &lt;strong&gt;All Counters&lt;/strong&gt; and &lt;strong&gt;All Instances&lt;/strong&gt; radio buttons &lt;/li&gt;    &lt;li&gt;Select the following from the &lt;strong&gt;Performance Object&lt;/strong&gt; dropdown, being sure to &lt;strong&gt;Add&lt;/strong&gt; each one as you select it:       &lt;ul&gt;       &lt;li&gt;Process &lt;/li&gt;        &lt;li&gt;Thread &lt;/li&gt;        &lt;li&gt;Processor &lt;/li&gt;        &lt;li&gt;Memory &lt;/li&gt;        &lt;li&gt;.NET CLR Data &lt;/li&gt;        &lt;li&gt;.NET CLR Exceptions &lt;/li&gt;        &lt;li&gt;.NET CLR Interop &lt;/li&gt;        &lt;li&gt;.NET CLR Jit &lt;/li&gt;        &lt;li&gt;.NET CLR Loading &lt;/li&gt;        &lt;li&gt;.NET CLR LocksAndThreads &lt;/li&gt;        &lt;li&gt;.NET CLR Memory &lt;/li&gt;        &lt;li&gt;.NET CLR Networking &lt;/li&gt;        &lt;li&gt;.NET CLR Remoting &lt;/li&gt;        &lt;li&gt;.NET CLR Security &lt;/li&gt;        &lt;li&gt;ASP.NET &lt;/li&gt;        &lt;li&gt;ASP.NET Applications &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Click &lt;strong&gt;Close&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;For the ASP.NET counters, select the version that you are wanting to monitor. Ex. For 1.1 framework, select &lt;strong&gt;ASP.NET v1.1.4322&lt;/strong&gt; and &lt;strong&gt;ASP.NET Applications v1.1.4322&lt;/strong&gt;.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Note: For more information on Performance monitor, see KB &lt;a href="http://support.microsoft.com/?id=248345"&gt;248345&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;C. Configure server to capture OutOfMemoryException    &lt;br /&gt;===========================================&lt;/p&gt;  &lt;p&gt;Add the following registry key. This was added to the .NET Framework so that a breakpoint exception will be thrown when an OutOfMemory condition occurs. This is documented in the following article:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://support.microsoft.com/?id=820745"&gt;820745 Failfast occurs when you experience an &amp;quot;out of memory&amp;quot; condition&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;pre class="code"&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\
DWord: GCFailFastOnOOM
Value: 2&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;D. Configure DebugDiag 
  &lt;br /&gt;=================== &lt;/p&gt;

&lt;p&gt;Configure DebugDiag to capture the memory dump when the BreakPoint Exception is thrown and when the process stops.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Open DebugDiag &lt;/li&gt;

  &lt;li&gt;On the Rules tab, click &lt;strong&gt;Add Rule&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Select &lt;strong&gt;Crash&lt;/strong&gt; and click &lt;strong&gt;Next&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Select &lt;strong&gt;All IIS Processes&lt;/strong&gt; and click &lt;strong&gt;Next&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click &lt;strong&gt;Advanced Exception Configuration&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click &lt;strong&gt;Add Exception&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Select &lt;strong&gt;Breakpoint Exception&lt;/strong&gt;, change Action Type to &lt;strong&gt;Full UserDump&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click &lt;strong&gt;Save and Close&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click &lt;strong&gt;Advanced Breakpoint Configuration&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click &lt;strong&gt;Add Breakpoint&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Type &lt;strong&gt;KERNEL32!ExitProcess&lt;/strong&gt; and change Action Type to &lt;strong&gt;Full UserDump&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click &lt;strong&gt;Save and Close&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Click Next through the rest of the wizard &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Inject LeakTrack.dll to capture native leak information:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Click the &lt;strong&gt;Processes&lt;/strong&gt; tab &lt;/li&gt;

  &lt;li&gt;Right-click the ASPNET_WP.exe process (or w3wp.exe if running in IIS 6), select &lt;strong&gt;Monitor for leaks&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;After the issue occurs&lt;/h3&gt;

&lt;p&gt;The memory dump will automatically get captured when the OutOfMemoryException is thrown.&lt;/p&gt;

&lt;p&gt;A. Stop the Performance Monitor log 
  &lt;br /&gt;=================================== &lt;/p&gt;

&lt;p&gt;In Performance Monitor:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Right click on your log that is now listed under &lt;strong&gt;Counter Logs&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;Choose &lt;strong&gt;Stop Log&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f05%2f19%2fasp-net-tips-what-to-gather-to-troubleshoot-part-5-outofmemoryexception.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%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f05%2f19%2fasp-net-tips-what-to-gather-to-troubleshoot-part-5-outofmemoryexception.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8519108" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/tom/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/High+Memory/default.aspx">High Memory</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET+Tip/default.aspx">ASP.NET Tip</category></item><item><title>Validation of viewstate MAC failed error</title><link>http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx</link><pubDate>Fri, 14 Mar 2008 19:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8206305</guid><dc:creator>Tom</dc:creator><slash:comments>97</slash:comments><comments>http://blogs.msdn.com/tom/comments/8206305.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=8206305</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=8206305</wfw:comment><description>&lt;h3&gt;&lt;font color="#008080"&gt;-- 3/17/2009 UPDATE --&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;If you are using .NET 2.0 or later, please upgrade to &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=AB99342F-5D1A-413D-8319-81DA479AB0D7&amp;amp;displaylang=en"&gt;.NET 3.5 SP1 (.NET 2.0 SP2)&lt;/a&gt; as it has a fix in it that should resolve this issue.&amp;#160; If you update and still have the problem, please post here so we know.&lt;/p&gt;  &lt;h3&gt;&lt;font color="#008080"&gt;-- 3/17/2009 UPDATE --&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Issue Description&lt;/h3&gt;  &lt;p&gt;You can get this Exception:    &lt;br /&gt;&lt;/p&gt;  &lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;  &lt;pre class="code"&gt;HttpException (0x80004005): Validation of viewstate 
MAC failed. If this application is hosted by a Web 
Farm or cluster, ensure that &lt;machinekey&gt; configuration 
specifies the same validationKey and validation 
algorithm. AutoGenerate cannot be used in a cluster.&lt;/pre&gt;

&lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;when the following preconditions are true: &lt;/p&gt;

&lt;p&gt;1. You aren't using a web farm. 
  &lt;br /&gt;2. It appears when using built-in databound controls such as GridView, DetailsView or FormView which utilize “DataKeyNames”. 

  &lt;br /&gt;3. It appears if you have a large page which loads slowly for any reason. &lt;/p&gt;

&lt;p&gt;If following preconditions are true and you click a postbacking control/link and the page hasn't loaded completely in client browser, you might get the &amp;quot;Validation of ViewState MAC failed&amp;quot; exception. &lt;/p&gt;

&lt;p&gt;When this happens, if you just try setting the page property &amp;quot;EnableViewStateMac&amp;quot; to false, it does not solve the problem, it just changes the error message in same navigation behavior: &lt;/p&gt;

&lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;

&lt;pre class="code"&gt;The state information is invalid for &lt;br /&gt;this page and might be corrupted.&lt;/pre&gt;

&lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Other exceptions that seem to be the same problem look like: &lt;/p&gt;

&lt;pre class="code"&gt;Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, 
Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, 
Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.test_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExec
utionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;amp; 
completedSynchronously) 

Nested Exception 

Exception: System.ArgumentException
Message: Invalid postback or callback argument. &lt;br /&gt;Event validation is enabled using in configuration &lt;br /&gt;or &amp;lt;%@ Page 
EnableEventValidation=&amp;quot;true&amp;quot; %&amp;gt; in a page. For security purposes, this feature 
verifies that arguments to postback or callback &lt;br /&gt;events originate from the server control that &lt;br /&gt;originally rendered them. If the data is valid &lt;br /&gt;and expected, use the &lt;br /&gt;ClientScriptManager.RegisterForEventValidation &lt;br /&gt;method in order to register the postback or &lt;br /&gt;callback data for validation.
Source: System.Web
at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String 
argument)
at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)
at System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, 
NameValueCollection postCollection)
at System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(St
ring postDataKey, NameValueCollection postCollection)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean 
fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, 
Boolean includeStagesAfterAsyncPoint) &lt;/pre&gt;
and 

&lt;pre class="code"&gt;Content-Length:1232
Content-Type:application/x-www-form-urlencoded
Accept:*/*
Accept-Encoding:gzip,deflate
Accept-Language:en-us
Cookie:ASP.NET_SessionId=skk4vriy1lzghm55bicesz45; 
Host:
User-Agent:T-Mobile Dash Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; 
Smartphone; 320x240) UA-OS:Windows CE (Smartphone) - Version 5.1
UA-color:color16
UA-pixels:320x240
x-wap-profile:&amp;quot;&amp;quot;
UA-Voice:TRUE
UA-CPU:x86
X-Forwarded-For: 

Thread: 964
Date: 2007-10-25 13:47:03,925
NDC: (null) 

Exception: System.Web.HttpException
Message: Validation of viewstate MAC failed.&lt;br /&gt; If this application is hosted by a Web 
Farm or cluster, ensure that &lt;machinekey&gt; configuration &lt;br /&gt;specifies the same validationKey and validation&lt;br /&gt;algorithm. AutoGenerate cannot be used in a cluster.
Source: System.Web
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String 
persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at 
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String 
serializedState)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String 
serializedState)
at System.Web.UI.HiddenFieldPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, 
Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, 
Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)&lt;br /&gt;at ASP.test_aspx.ProcessRequest(HttpContext context) 
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExec
utionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;amp; 
completedSynchronously) 

Nested Exception 

Exception: System.Web.UI.ViewStateException
Message: Invalid viewstate. 
Client IP: 
Port: 61362
User-Agent: T-Mobile Dash Mozilla/4.0 (compatible; MSIE 4.01; 
Windows CE; Smartphone; 320x240)
ViewState: 
/wEPDwUJMjUyNTI1NDMyD2QWAmYPZBYCAgEPZBYEAlAPD2QWAh4Kb25rZXlwcmVzcwUqcmV0dXJuIGNsaWNr
QnV0dG9uKGV2ZW50LCdjdGwwMF9pYlNlYXJjaCcpZAJWD2QWBAIBD2QWBAIDDw9kFgIfAAUxcmV0dXJuIGNs
aWNrQnV0dG9uKGV2ZW50LCdjdGwwMF9jcDFfRmxhc2hCdXR0b24nKWQCBg8UKwACDxYCHghJbWFnZVVybAUj
fi9faG9tZV9hZF91bml0cy9ob21lX2FkdW5pdHMxMS5qcGdkDxQrAAMWCB4LQ29vcmRpbmF0ZXMFFzAsMCwy
NTUsMCwyMjQsMTEwLDAsMTEwHgtOYXZpZ2F0ZVVybAUGfi9uZmwvHg1BbHRlcm5hdGVUZXh0BSNUaGUgcnVz
aCB0byBGYXRoZWFkIGZvb3RiYWxsIGlzIG9uIR4GVGFyZ2V0ZRYIHwIFGzQ5OCwwLDQ1OCwxMTAsMjI0LDEx
MCwyNTUsMB8DBRB+L2hlcm9lcy9iYXRtYW4vHwQFOVRoZSBEYXJrIEtuaWdodCBpcyBoZXJlLi4uYW5kIGhl
J3MgYnJvdWdodCBzb21lIGZyaWVuZCdzIR8FZRYIHwIFGzcwOCwxMTAsNzM5LDAsNDk4LDAsNDU4LDExMB8D
BQZ+L21sYi8fBAUhTUxCIGhpdHMgYSBob21lIHJ1biB3aXRoIEZhdGhlYWQhHwVlFCsBAwICAgICAmQCAw8P
FgIeB1Zpc2libGVoZBYCAgEPZBYCZg8PZBYCHwAFMnJldHVybiBjbGlja0J1dHRvbihldmVudCwnY3RsMDBf
Y3AxX1N0YXRpY0J1dHRvbicpZBgBBR5f... 

Nested Exception 

Exception: System.Web.HttpException
Message: Unable to validate data.
Source: System.Web
at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] 
modifier, Int32 start, Int32 length, Int32&amp;amp; dataLength)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) &lt;/pre&gt;

&lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Root Cause&lt;/h3&gt;

&lt;p&gt;This exception appears because Controls using DataKeyNames require Viewstate to be encrypted. When Viewstate is encrypted (Default mode, Auto, is to encrypt if controls require that, otherwise not), Page adds &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__VIEWSTATEENCRYPTED&amp;quot; id=&amp;quot;__VIEWSTATEENCRYPTED&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt; field just before closing of the &amp;lt;form&amp;gt; tag. But this hidden field might not have been rendered to the browser with long-running pages, and if you make a postback before it does, the browser initiates postback without this field (in form post collection). End result is that if this field is omitted on postback, the page doesn't know that Viewstate is encrypted and causes the aforementioned Exception. I.E. page expects to be fully-loaded before you make a postback. &lt;/p&gt;

&lt;p&gt;And by the way similar problem is with event validation since __EVENTVALIDATION field is also rendered on the end of the form. This is a security feature that ensures that postback actions only come from events allowed and created by the server to help prevent spoofed postbacks. This feature is implemented by having controls register valid events when they render (as in, during their actual Render() methods). The end result is that at the bottom of your rendered &amp;lt;form&amp;gt; tag, you'll see something like this: &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__EVENTVALIDATION&amp;quot; id=&amp;quot;__EVENTVALIDATION&amp;quot; value=&amp;quot;AEBnx7v.........tS&amp;quot; /&amp;gt;. When a postback occurs, ASP.NET uses the values stored in this hidden field to ensure that the button you clicked invokes a valid event. If it's not valid, you get the exception above. &lt;/p&gt;

&lt;p&gt;The problem happens specifically when you postback before the EventValidation field has been rendered. If EventValidation is enabled (which it is, by default), but ASP.net doesn't see the hidden field when you postback, you also get the exception. If you submit a form before it has been entirely rendered, then chances are the EventValidation field has not yet been rendered, and thus ASP.NET cannot validate your click.&lt;/p&gt;

&lt;h3&gt;Workarounds&lt;/h3&gt;

&lt;p&gt;1. Set enableEventValidation to false and viewStateEncryptionMode to Never as follows: &lt;/p&gt;

&lt;pre class="code"&gt;&amp;lt;pages enableeventvalidation=&amp;quot;false&amp;quot; 
    viewstateencryptionmode=&amp;quot;Never&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;This has the unwanted side-effect of disabling validation and encryption.&amp;#160; On some sites, this may be ok to do, but it isn't a best practice, especially in publicly facing sites.&lt;/p&gt;

&lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;2. Another way around the problem is to mark the form as disabled and then enable it in script once the load is complete: &lt;/p&gt;

&lt;pre class="code"&gt;  function enableForm() { 
      document.getElementById(&amp;quot;form&amp;quot;).disabled = false; 
  } 

  window.onLoad = enableForm();&lt;/pre&gt;

&lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Or you can disable the individual form elements and enable them once everything is loaded: &lt;/p&gt;

&lt;pre class="code"&gt;  function disableElements(elements) { 
  for (var i = elements.length - 1; i &amp;gt;= 0; i--) { 
    var elmt = elements[i]; 

    if (!elmt.disabled) { 
      elmt.disabled = true; 
    } 
    else { 
      elmt._wasDisabled = true; 
    } 
  } 
} 

function disableFormElements() { 
  disableElements(_form.getElementsByTagName(&amp;quot;INPUT&amp;quot;)); 
  disableElements(_form.getElementsByTagName(&amp;quot;SELECT&amp;quot;)); 
  disableElements(_form.getElementsByTagName(&amp;quot;TEXTAREA&amp;quot;)); 
  disableElements(_form.getElementsByTagName(&amp;quot;BUTTON&amp;quot;)); 
  disableElements(_form.getElementsByTagName(&amp;quot;A&amp;quot;)); 
} 

function enableElements(elements) { 
  for (var i = elements.length - 1; i &amp;gt;= 0; i--) { 
    var elmt = elements[i]; 
    if (!elmt._wasDisabled) { 
      elmt.disabled = false; 
    } 
    else { 
      elmt._wasDisabled = null; 
    } 
  } 
} 

function enableFormElements() { 
  enableElements(_form.getElementsByTagName(&amp;quot;INPUT&amp;quot;));
  enableElements(_form.getElementsByTagName(&amp;quot;SELECT&amp;quot;));
  enableElements(_form.getElementsByTagName(&amp;quot;TEXTAREA&amp;quot;));
  enableElements(_form.getElementsByTagName(&amp;quot;BUTTON&amp;quot;));
  enableElements(_form.getElementsByTagName(&amp;quot;A&amp;quot;));
} &lt;/pre&gt;

&lt;br /&gt;Make sure that the variable _form is set to the ASP.net form on the page. Then just call enableFormElements() and disableFormElements(). 

&lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;3. The last way to workaround this problem is to override the &lt;strong&gt;Render&lt;/strong&gt; Event of the page to place the hidden fields for Encrypted Viewstate and Event validation on the top of the form.&amp;#160; This will ensure that these things get written out before anything that can submit the form: &lt;/p&gt;

&lt;p mce_keep="true"&gt;&amp;#160;&lt;/p&gt;

&lt;pre class="code"&gt;protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
  System.IO.StringWriter stringWriter = &lt;br /&gt;      new System.IO.StringWriter();
  HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
  base.Render(htmlWriter);
  string html = stringWriter.ToString();
  string[] aspnet_formelems = new string[5];
  aspnet_formelems[0] = &amp;quot;__EVENTTARGET&amp;quot;;
  aspnet_formelems[1] = &amp;quot;__EVENTARGUMENT&amp;quot;;
  aspnet_formelems[2] = &amp;quot;__VIEWSTATE&amp;quot;;
  aspnet_formelems[3] = &amp;quot;__EVENTVALIDATION&amp;quot;;&lt;br /&gt;  aspnet_formelems[4] = &amp;quot;__VIEWSTATEENCRYPTED&amp;quot;;
  foreach (string elem in aspnet_formelems)
  {
    //Response.Write(&amp;quot;input type=&amp;quot;&amp;quot;hidden&amp;quot;&amp;quot; name=&amp;quot;&amp;quot;&amp;quot; &amp;amp; abc.ToString &amp;amp; &amp;quot;&amp;quot;&amp;quot;&amp;quot;)
    int StartPoint = html.IndexOf(&amp;quot;&amp;lt;input type=\&amp;quot;hidden\&amp;quot; name=\&amp;quot;&amp;quot; + 
      elem.ToString() + &amp;quot;\&amp;quot;&amp;quot;);
    if (StartPoint &amp;gt;= 0)
    {
      //does __VIEWSTATE exist?
      int EndPoint = html.IndexOf(&amp;quot;/&amp;gt;&amp;quot;, StartPoint) + 2;
      string ViewStateInput = html.Substring(StartPoint, &lt;br /&gt;        EndPoint - StartPoint);
      html = html.Remove(StartPoint, EndPoint - StartPoint);
      int FormStart = html.IndexOf(&amp;quot;&amp;lt;form&amp;quot;);
      int EndForm = html.IndexOf(&amp;quot;&amp;gt;&amp;quot;, FormStart) + 1;
      if (EndForm &amp;gt;= 0)
        html = html.Insert(EndForm, ViewStateInput);
    }
  }

  writer.Write(html);
}&lt;/pre&gt;

&lt;h5&gt;Update&lt;/h5&gt;

&lt;p mce_keep="true"&gt;Another solution based on #3 above, special thanks to Alex for posting this in the comments below.&amp;#160; He wrote a small class called BasePage that fixes the issues, so you just have to extend your page from BasePage instead of Page:&lt;/p&gt;

&lt;div style="border-bottom: gray 1px solid; border-left: gray 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; BasePage : Page&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] aspNetFormElements = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  { &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #006080"&gt;&amp;quot;__EVENTTARGET&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #006080"&gt;&amp;quot;__EVENTARGUMENT&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #006080"&gt;&amp;quot;__VIEWSTATE&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #006080"&gt;&amp;quot;__EVENTVALIDATION&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #006080"&gt;&amp;quot;__VIEWSTATEENCRYPTED&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  };&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Render(HtmlTextWriter writer)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    StringWriter stringWriter = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StringWriter();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    HtmlTextWriter htmlWriter = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HtmlTextWriter(stringWriter);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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;base&lt;/span&gt;.Render(htmlWriter);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; html = stringWriter.ToString();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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;int&lt;/span&gt; formStart = html.IndexOf(&lt;span style="color: #006080"&gt;&amp;quot;&amp;lt;form&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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;int&lt;/span&gt; endForm = -1;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; (formStart &amp;gt;= 0)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      endForm = html.IndexOf(&lt;span style="color: #006080"&gt;&amp;quot;&amp;gt;&amp;quot;&lt;/span&gt;, formStart);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; (endForm &amp;gt;= 0)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      StringBuilder viewStateBuilder = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; element &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; aspNetFormElements)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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;int&lt;/span&gt; startPoint = html.IndexOf(&lt;span style="color: #006080"&gt;&amp;quot;&amp;lt;input type=\&amp;quot;hidden\&amp;quot; name=\&amp;quot;&amp;quot;&lt;/span&gt; + element + &lt;span style="color: #006080"&gt;&amp;quot;\&amp;quot;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; (startPoint &amp;gt;= 0 &amp;amp;&amp;amp; startPoint &amp;gt; endForm)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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;int&lt;/span&gt; endPoint = html.IndexOf(&lt;span style="color: #006080"&gt;&amp;quot;/&amp;gt;&amp;quot;&lt;/span&gt;, startPoint);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; (endPoint &amp;gt;= 0)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;          {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            endPoint += 2;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; viewStateInput = html.Substring(startPoint, endPoint - startPoint);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            html = html.Remove(startPoint, endPoint - startPoint);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            viewStateBuilder.Append(viewStateInput).Append(&lt;span style="color: #006080"&gt;&amp;quot;\r\n&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;          }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; 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; (viewStateBuilder.Length &amp;gt; 0)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        viewStateBuilder.Insert(0, &lt;span style="color: #006080"&gt;&amp;quot;\r\n&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        html = html.Insert(endForm + 1, viewStateBuilder.ToString());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    writer.Write(html);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; 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: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;There are many other workarounds for the above mentioned problem; however no definite solution. &lt;/p&gt;

&lt;h3&gt;Further Information around this problem&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://forums.asp.net/p/955145/1173230.aspx" mce_href="http://forums.asp.net/p/955145/1173230.aspx"&gt;ASP.NET Forum link&lt;/a&gt; 

  &lt;br /&gt;&lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101988" mce_href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101988"&gt;Connect Bug&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, if you use Server.Transfer on your page, you you can also run into this issue.&amp;#160; For information on that, take a look at the documentation found &lt;a href="http://msdn.microsoft.com/en-us/library/caxa892w.aspx"&gt;here&lt;/a&gt;.&amp;#160; Specifically:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;If you set &lt;strong&gt;preserveForm&lt;/strong&gt; to &lt;strong&gt;true&lt;/strong&gt; and if the &lt;strong&gt;enableViewStateMac&lt;/strong&gt; attribute of the &lt;a href="http://msdn.microsoft.com/en-us/library/950xf363.aspx"&gt;pages&lt;/a&gt; configuration element is &lt;strong&gt;true&lt;/strong&gt;, ASP.NET will raise an exception when &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.transfer.aspx"&gt;Transfer&lt;/a&gt; is executed because the view state from the page that calls &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.transfer.aspx"&gt;Transfer&lt;/a&gt; is not valid on the destination page. One of the preserved form fields on the calling page is the hidden &lt;strong&gt;__VIEWSTATE&lt;/strong&gt; form field, which holds the view state for the page. When &lt;strong&gt;enableViewStateMac&lt;/strong&gt; is &lt;strong&gt;true&lt;/strong&gt;, ASP.NET runs a message authentication check on the view state of the destination page when the page is posted back from the client and the check will fail.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And there is a &lt;a href="http://support.microsoft.com/kb/316920/"&gt;KB article&lt;/a&gt; on this with a few resolutions.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f03%2f14%2fvalidation-of-viewstate-mac-failed-error.aspx" mce_href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f03%2f14%2fvalidation-of-viewstate-mac-failed-error.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%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f03%2f14%2fvalidation-of-viewstate-mac-failed-error.aspx" mce_src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f03%2f14%2fvalidation-of-viewstate-mac-failed-error.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8206305" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category></item><item><title>HOWTO: Capture a dump on a specific managed exception</title><link>http://blogs.msdn.com/tom/archive/2008/02/25/howto-capture-a-dump-on-a-specific-managed-exception.aspx</link><pubDate>Mon, 25 Feb 2008 17:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7894815</guid><dc:creator>Tom</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/tom/comments/7894815.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=7894815</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=7894815</wfw:comment><description>&lt;P&gt;So often times, we get an exception of interest, either we see it in the Event Log or we see it in a dump and we want to get a dump at the time of the exception to see what was happening.&amp;nbsp; So how do we go about doing that?&amp;nbsp; Well, the answer is, there are a few ways you can do this.&lt;/P&gt;
&lt;H2&gt;DebugDiag Methods&lt;/H2&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;Note: This method currently only works on 32-bit processes&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The first way to get a dump on a specific exception is to use &lt;A title=DebugDiag href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1286" mce_href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1286"&gt;DebugDiag&lt;/A&gt;.&amp;nbsp; After installing this tool and running it, you will use the &lt;STRONG&gt;Crash&lt;/STRONG&gt; rule.&amp;nbsp; After picking your process, on the &lt;STRONG&gt;Advanced Configuration (Optional)&lt;/STRONG&gt; screen, click on the &lt;STRONG&gt;Exceptions&lt;/STRONG&gt; button&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/HOWTOCaptureadumponaspecificmanagedexcep_E09A/Exception2_2.png" mce_href="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/HOWTOCaptureadumponaspecificmanagedexcep_E09A/Exception2_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" border=0 alt=Exception2 src="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/HOWTOCaptureadumponaspecificmanagedexcep_E09A/Exception2_thumb.png" width=444 height=234 mce_src="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/HOWTOCaptureadumponaspecificmanagedexcep_E09A/Exception2_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;After you click on this, you will select the &lt;STRONG&gt;CLR (.NET) Exception&lt;/STRONG&gt; and then enter your exception type that you want to get the dump on&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/HOWTOCaptureadumponaspecificmanagedexcep_E09A/Exception1_2.png" mce_href="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/HOWTOCaptureadumponaspecificmanagedexcep_E09A/Exception1_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" border=0 alt=Exception1 src="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/HOWTOCaptureadumponaspecificmanagedexcep_E09A/Exception1_thumb.png" width=486 height=234 mce_src="http://blogs.msdn.com/blogfiles/tom/WindowsLiveWriter/HOWTOCaptureadumponaspecificmanagedexcep_E09A/Exception1_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;That is all there is to it.&amp;nbsp; You have now setup DebugDiag to capture a dump on the specific exception that you are interested in.&amp;nbsp; Good luck!&lt;/P&gt;
&lt;H2&gt;Adplus - Windbg Method&lt;/H2&gt;
&lt;P&gt;This method requires that you have installed the &lt;A href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx" mce_href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx"&gt;debuggers package&lt;/A&gt;.&amp;nbsp; And keep in mind there are packages for 32-bit and 64-bit versions of the debugger and you should install the one that matches the process you are trying to debug.&lt;/P&gt;
&lt;P&gt;There is an excellent posting about capturing a dump using adplus &lt;A href="http://blogs.msdn.com/carloc/archive/2007/10/08/ok-now-how-do-i-capture-my-dump.aspx" mce_href="http://blogs.msdn.com/carloc/archive/2007/10/08/ok-now-how-do-i-capture-my-dump.aspx"&gt;here&lt;/A&gt;.&amp;nbsp; So I am going to extend on that to allow us to capture a dump on a particular exception.&amp;nbsp; So in that case, we want the config file we create for adplus to have some specific things in it.&amp;nbsp; But what we put in there kind of depends on what version of the .NET Framework we are using.&lt;/P&gt;
&lt;H4&gt;.NET Framework 1.x&lt;/H4&gt;
&lt;P&gt;So if we are using 1.0 or 1.1, we will want the config file to look like this:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=debug&gt;&amp;lt;adplus&amp;gt;
  &amp;lt;precommands&amp;gt;
     &amp;lt;cmd&amp;gt;.load clr10\sos.dll&amp;lt;/cmd&amp;gt;
  &amp;lt;/precommands&amp;gt;

  &amp;lt;exceptions&amp;gt;
     &amp;lt;config&amp;gt;
        &amp;lt;!-- This is for the CLR exception --&amp;gt;
       &amp;lt;code&amp;gt; clr &amp;lt;/code&amp;gt;
       &amp;lt;actions1&amp;gt; Log &amp;lt;/actions1&amp;gt;
       &amp;lt;customactions1&amp;gt; !cce &lt;BR&gt;System.IndexOutOfRangeException 1; j ($t1 = 1)&lt;BR&gt; '.dump /ma /u c:\dumps\mydump.dmp' ; ''&lt;BR&gt;       &amp;lt;/customactions1&amp;gt;
       &amp;lt;returnaction1&amp;gt; gn  &amp;lt;/returnaction1&amp;gt;
       &amp;lt;actions2&amp;gt; Log;FullDump &amp;lt;/actions2&amp;gt;
     &amp;lt;/config&amp;gt;

      &amp;lt;option&amp;gt;  NoDumpOnFirstChance  &amp;lt;/option&amp;gt;
  &amp;lt;/exceptions&amp;gt;

&amp;lt;/adplus&amp;gt;&lt;/PRE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;.NET Framework 2.0&lt;/H4&gt;
&lt;P&gt;For 2.0, it should look like:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=debug&gt;&amp;lt;adplus&amp;gt;
    &amp;lt;precommands&amp;gt;
        &amp;lt;cmd&amp;gt;.loadby sos mscorwks &amp;lt;/cmd&amp;gt;
        &amp;lt;cmd&amp;gt;sxe –c "!soe &lt;BR&gt;System.Security.SecurityException 1; &lt;BR&gt;.if(@$t1==1) { .dump /ma /u &lt;BR&gt;c:\DebugOut\exception.dmp } .else {g}" clr&lt;BR&gt;        &amp;lt;/cmd&amp;gt;
    &amp;lt;/precommands&amp;gt;

  &amp;lt;exceptions&amp;gt;
      &amp;lt;option&amp;gt;  NoDumpOnFirstChance  &amp;lt;/option&amp;gt;
  &amp;lt;/exceptions&amp;gt;

&amp;lt;/adplus&amp;gt;&lt;/PRE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;Note: The customactions1 and cmd lines above should all be one line, they were changed so it would fit the screen.&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please keep in mind that we must use the same debugger package (32-bit or 64-bit) as the process we are trying to debug.&lt;/P&gt;
&lt;P&gt;Good luck and happy debugging.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f02%2f25%2fhowto-capture-a-dump-on-a-specific-managed-exception.aspx" mce_href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f02%2f25%2fhowto-capture-a-dump-on-a-specific-managed-exception.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%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f02%2f25%2fhowto-capture-a-dump-on-a-specific-managed-exception.aspx" mce_src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2ftom%2farchive%2f2008%2f02%2f25%2fhowto-capture-a-dump-on-a-specific-managed-exception.aspx"&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7894815" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category></item></channel></rss>