<?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>WebTopics</title><link>http://blogs.msdn.com/webtopics/default.aspx</link><description>IIS and ASP.NET Information and Tips from Microsoft Developer Support</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How To: Collect a Crash dump of an IIS worker process on IIS 7.0 (and above)</title><link>http://blogs.msdn.com/webtopics/archive/2009/11/25/how-to-collect-a-crash-dump-of-an-iis-worker-process-w3wp-exe-on-iis-7-0-and-above.aspx</link><pubDate>Wed, 25 Nov 2009 14:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9924531</guid><dc:creator>puneetg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9924531.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9924531</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9924531</wfw:comment><description>&lt;p mce_keep="true"&gt; Web server Administrators have been using the &lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1286" target="_blank" mce_href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1286"&gt;Debug Diagnostic 1.1&lt;/a&gt; to troubleshoot crash\hang issues on IIS 5 and 6. The Debug Diagnostic tool needs no introduction. It is a great tool and it provides you a lot of flexibility in collecting crash dumps for any user mode process running on a server.&amp;#160; But as of now, the Debug Diagnostic tool is *not* compatible with Windows Server 2008 and it is recommended that you not use it on a Windows 2008 server because you may get unexpected results. The good news is that the Debug Diagnostic team is currently working on releasing a version that is compatible with Windows 2008, &lt;strong&gt;&lt;u&gt;but what to do until that time&lt;/u&gt;&lt;/strong&gt;?&lt;/p&gt;  &lt;p&gt;The answer is to leverage the powerful Windows Error Reporting (&lt;u&gt;WER&lt;/u&gt;) feature that comes with Windows 2008. You can use &lt;u&gt;WER &lt;/u&gt;on a Windows 2008 server to collect a crash dump of any process without any other tools.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;The good news is&lt;/u&gt;&lt;/strong&gt; that Windows Error Reporting is enabled by default on every Windows 2008 server and takes dumps of all application crashes on the server. If you have experienced crashes of an IIS worker process, all you have to do is check if there is a dump generated for you already. To do that, please follow these steps.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Click on Start-&amp;gt; Run and type &lt;strong&gt;WERCON&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;This will open up the “Problems Reports and Solutions” dialog box and it will look like this.      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/WerScreen1_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/WerScreen1_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="WerScreen1" border="0" alt="WerScreen1" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/WerScreen1_thumb.jpg" width="620" height="364" mce_src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/WerScreen1_thumb.jpg" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;From here, just click on “View Problem History” and see if you can find any crashes for “IIS Worker Process”      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/ViewProblemHistory_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/ViewProblemHistory_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ViewProblemHistory" border="0" alt="ViewProblemHistory" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/ViewProblemHistory_thumb.jpg" width="620" height="364" mce_src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/ViewProblemHistory_thumb.jpg" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;You can select the particular IIS Worker Process crash entry and right click on it and choose “View Problem details”. This will open up a window like this which will give you an overall idea of the crash.      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/ViewProblemDetails_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/ViewProblemDetails_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ViewProblemDetails" border="0" alt="ViewProblemDetails" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/ViewProblemDetails_thumb.jpg" width="712" height="573" mce_src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/ViewProblemDetails_thumb.jpg" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;To get the dump files for this crash, just right click on “View a temporary copy of these files” and this will copy the relevant .hdmp , .mdmp and version.txt to your local temporary folder. These are the dump files which you can either analyze using WinDBG or send to Microsoft for further analysis. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Windows Error Reporting introduced a new feature (in Windows Vista and above) which lets you create a &lt;a href="http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx"&gt;LocalDumps registry key&lt;/a&gt; under &lt;b&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting&lt;/b&gt; and then under that you can create a subkey with the name of the executable that you want to take dumps for. This approach had a few limitations as of now. It turned out that :&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;This feature works only if &lt;strong&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Auto &lt;/strong&gt;is set to 0. If Auto is set to 1, the control is given to the debugger specified in &lt;strong&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug&lt;/strong&gt;\Debugger setting and the debugger decides what to do with the unhandled exception and WER is not given a chance to handle the exception. &lt;/li&gt;    &lt;li&gt;The .net framework version 3.5 and below do not recognize this registry key. This means that if your process has some managed code and if some unhandled exception happens while managed code execution (the exception may be native or a CLR exception), the LocalDumps method will not get you dumps for the process. The functionality inside the .net CLR to read the LocalDumps registry key is added in .net framework 4.0. Because of this limitation, the LocalDump feature becomes less useful for an IIS worker process because most of the time an IIS worker process is running ASP.NET applications or some managed code.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;What if WER is not taking the dumps for the process of interest&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;If you notice that dumps are not getting generated, you can check the general WER settings on your machine. These settings can be configured at &lt;strong&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting.&lt;/strong&gt; The complete list is available at &lt;a title="http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx" href="http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx&lt;/a&gt;. I will just include the most relevant ones in regard to taking dumps :       &lt;br /&gt;      &lt;br /&gt;      &lt;table class="class" border="1" cellspacing="0" cellpadding="0" width="709"&gt;&lt;tbody&gt;         &lt;tr&gt;           &lt;td class="class" valign="top" width="200"&gt;Disabled&lt;/td&gt;            &lt;td class="class" valign="top" width="507"&gt;Should be 0. If this is set to 1, WER will be disabled completely&lt;/td&gt;         &lt;/tr&gt;          &lt;tr&gt;           &lt;td class="class" valign="top" width="200"&gt;ForceQueue&lt;/td&gt;            &lt;td class="class" valign="top" width="507"&gt;Default value is 0 but you can set it to 1 to ensure that dumps are generated on every crash&lt;/td&gt;         &lt;/tr&gt;          &lt;tr&gt;           &lt;td class="class" valign="top" width="200"&gt;DisableQueue&lt;/td&gt;            &lt;td class="class" valign="top" width="507"&gt;Should be 0&lt;/td&gt;         &lt;/tr&gt;          &lt;tr&gt;           &lt;td class="class" valign="top" width="200"&gt;DisableArchive&lt;/td&gt;            &lt;td class="class" valign="top" width="507"&gt;Should be 0&lt;/td&gt;         &lt;/tr&gt;          &lt;tr&gt;           &lt;td class="class" valign="top" width="200"&gt;CorporateWERServer&lt;/td&gt;            &lt;td class="class" valign="top" width="507"&gt;If you want to keep the data locally on the server and don't want the dumps to be moved to the WER server, you can set this setting to a non-existing server in your domain. This will ensure that the data is stored locally on the server.&lt;/td&gt;         &lt;/tr&gt;          &lt;tr&gt;           &lt;td class="class" valign="top" width="200"&gt;MaxQueueCount&lt;/td&gt;            &lt;td class="class" valign="top" width="507"&gt;Default is 50, You can increase this to a higher number to increase the total number of dumps that will be saved to the ReportQueue(For more information on ReportQueue, refer to this &lt;a href="http://blogs.technet.com/brad_rutkowski/archive/2007/04/18/what-s-crashing-on-my-vista-machine.aspx" target="_blank"&gt;article&lt;/a&gt;)&lt;/td&gt;         &lt;/tr&gt;       &lt;/tbody&gt;&lt;/table&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Another important thing to be aware of while using Windows Error Reporting is that a lot of Windows Error Reporting settings can be configured via group policy. To look at the WER settings on your server, open up Local Group Policy Editor (GPEDIT.MSC) and you will be able to see these settings under Computer Configuration –&amp;gt; Administrative Templates –&amp;gt; Windows Components –&amp;gt; Windows Error Reporting. This is how it looks. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/gp_4.png" mce_href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/gp_4.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="gp" border="0" alt="gp" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/gp_thumb_1.png" width="903" height="342" mce_src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/HowToCollectaCrashdumpofanIISw.0andabove_59B/gp_thumb_1.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The relevant WER settings defined in group policy will override the local settings. Most of these group policies don't apply to Windows Vista and above. The ones that do apply are&lt;/p&gt;    &lt;ol&gt;     &lt;li&gt;       &lt;div align="left"&gt;Disable Windows Error Reporting &lt;/div&gt;     &lt;/li&gt;   &lt;/ol&gt;    &lt;p align="left"&gt;(Under Advanced Error Reporting Settings )&lt;/p&gt;    &lt;ol&gt;     &lt;li&gt;       &lt;div align="left"&gt;Configure Report Archive &lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="left"&gt;Configure Corporate Windows Error Reporting &lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="left"&gt;List of applications to be excluded &lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="left"&gt;Configure Report Queue &lt;/div&gt;     &lt;/li&gt;   &lt;/ol&gt; &lt;/blockquote&gt;  &lt;p&gt;There may be specific reasons why the WER settings are disabled on domain and it is recommended to get in touch with an Administrator before making any changes to the above policies. Explaining these group policy entries would result in a discussion outside of the scope of this post, so I recommend looking at the MSDN &lt;a href="http://technet.microsoft.com/en-us/library/bb490841.aspx" target="_blank"&gt;documentation&lt;/a&gt; for the above policy settings for more information on them.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Windows Error Reporting and ADPLUS&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Administrators who are aware of Debug Diagnostic tool may also know about another tool called ADPLUS.VBS that ships with the &lt;a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" target="_blank" mce_href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;Debugging Tools For Windows&lt;/a&gt;. Though ADPLUS.VBS tool has a &lt;strong&gt;-crash&lt;/strong&gt; switch that lets you attach a debugger to a process in CRASH mode, it is not the best option to use while troubleshooting worker process crashes because ADPLUS doesn’t have the ability to auto-attach to a new process. You can only attach ADPLUS to a process which is already running on the machine. This becomes a big limitation for an IIS worker process because a worker process may recycle or shut-down based on what is configured in the application pool settings. Another problem with ADPLUS is that it starts a new window for cdb.exe and someone may accidently close this window which may end up killing the worker process itself. &lt;/p&gt;    &lt;p&gt;You may have noticed that WER just lets you generate a crash dump for a process when it crashes and doesn’t provide you the flexibility that Debug Diagnostic provides you though (e.g. taking dump on specific exceptions, specific breakpoints, events etc.). If you want to dump your process on a particular exception on Windows 2008 and above, you still have to use the ADPLUS tool. The discussion how to use ADPLUS to troubleshoot crashes for a process is out of the scope of this article. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;ProcDump&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;This is one of the latest additions in the Sysinternals suite of tools. ProcDump is a command-line utility whose primary purpose is monitoring an application for CPU spikes and generating crash dumps during a spike that an administrator or developer can use to determine the cause of the spike. ProcDump also includes hung window monitoring (using the same definition of a window hang that Windows and Task Manager use) and unhandled exception monitoring. It also can serve as a general process dump utility that you can embed in other scripts. I won’t spent too much time talking about PROCDUMP in this blog post because we already have another post which talks about this tool in detail - &lt;a title="http://blogs.msdn.com/webtopics/archive/2009/08/08/using-procdump-exe-to-monitor-w3wp-exe-for-cpu-spikes.aspx" href="http://blogs.msdn.com/webtopics/archive/2009/08/08/using-procdump-exe-to-monitor-w3wp-exe-for-cpu-spikes.aspx" mce_href="http://blogs.msdn.com/webtopics/archive/2009/08/08/using-procdump-exe-to-monitor-w3wp-exe-for-cpu-spikes.aspx"&gt;http://blogs.msdn.com/webtopics/archive/2009/08/08/using-procdump-exe-to-monitor-w3wp-exe-for-cpu-spikes.aspx&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;References&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Windows Error Reporting (WER) for developers &lt;a href="http://blogs.msdn.com/oanapl/archive/2009/01/28/windows-error-reporting-wer-for-developers.aspx" mce_href="http://blogs.msdn.com/oanapl/archive/2009/01/28/windows-error-reporting-wer-for-developers.aspx"&gt;http://blogs.msdn.com/oanapl/archive/2009/01/28/windows-error-reporting-wer-for-developers.aspx&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Using WER: Collecting User-Mode Dumps &lt;a href="http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;How to use ADPlus to troubleshoot &amp;quot;hangs&amp;quot; and &amp;quot;crashes&amp;quot; &lt;a title="http://support.microsoft.com/kb/286350" href="http://support.microsoft.com/kb/286350" mce_href="http://support.microsoft.com/kb/286350"&gt;http://support.microsoft.com/kb/286350&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9924531" width="1" height="1"&gt;</description></item><item><title>Configuring FTP 7.5 with Host Header and SSL</title><link>http://blogs.msdn.com/webtopics/archive/2009/11/06/configuring-ftp-7-5-with-host-header-and-ssl.aspx</link><pubDate>Fri, 06 Nov 2009 00:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9918310</guid><dc:creator>Saurabh Singh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9918310.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9918310</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9918310</wfw:comment><description>&lt;P&gt;FTP 7.5 comes with new features like supporting Host headers (Virtual host) and SSL. For compatibility purposes, FTP clients&amp;nbsp;can check whether the FTP server supports host headers by sending a FEAT command to check for supported features. An FTP server would respond with HOST being one of the extended features supported by it and from here on client can use this feature.&lt;/P&gt;
&lt;P&gt;There are two ways of using this feature currently by the FTP clients:&lt;/P&gt;
&lt;P&gt;1. They can send the virtual host name along with the Username while getting authenticated by the FTP server as below:&lt;/P&gt;
&lt;DIV class=error&gt;
&lt;P&gt;C:\&amp;gt;ftp ftp.me.com &lt;BR&gt;Connected to ftp.me.com. &lt;BR&gt;220 Microsoft FTP Service &lt;BR&gt;User (ftp.me.com:(none)): ftp.me.com|&amp;lt;username&amp;gt; &lt;BR&gt;331 Password required for ftp.me.com|&amp;lt;username&amp;gt; &lt;BR&gt;Password: &lt;BR&gt;230 User logged in. &lt;BR&gt;ftp&amp;gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;or,&lt;/P&gt;
&lt;P&gt;2. They can send the following command to connect to a specific Virtual host name as below:&lt;/P&gt;
&lt;DIV class=error&gt;
&lt;P&gt;ftp&amp;gt; quote host ftp.me.com &lt;BR&gt;220 Host accepted. &lt;BR&gt;ftp&amp;gt; user &lt;BR&gt;Username &amp;lt;username&amp;gt; &lt;BR&gt;331 Password required for &amp;lt;username&amp;gt;. &lt;BR&gt;Password: &lt;BR&gt;230 User logged in. &lt;BR&gt;ftp&amp;gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;In this example&amp;nbsp;the test is done through the default ftp.exe that comes bundled with Windows OS. Smart FTP clients can send the HOST seamlessly without the end user knowing about it.&lt;/P&gt;
&lt;P&gt;If you are setting up your FTP site on IIS 7 over SSL using the host header there are some caveats you need to remember as discussed below.&lt;/P&gt;
&lt;P&gt;I have an FTP site as shown below which is using a Host header and is configured to accept SSL connections.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ConfiguringFTP7.5withHostHeaderandSSL_8B0C/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ConfiguringFTP7.5withHostHeaderandSSL_8B0C/image_2.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; DISPLAY: inline; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=152 alt=image src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ConfiguringFTP7.5withHostHeaderandSSL_8B0C/image_thumb.png" width=455 border=0 mce_src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ConfiguringFTP7.5withHostHeaderandSSL_8B0C/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Under FTP SSL Settings I have the following configuration as shown below:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ConfiguringFTP7.5withHostHeaderandSSL_8B0C/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ConfiguringFTP7.5withHostHeaderandSSL_8B0C/image_4.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; DISPLAY: inline; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=294 alt=image src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ConfiguringFTP7.5withHostHeaderandSSL_8B0C/image_thumb_1.png" width=436 border=0 mce_src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ConfiguringFTP7.5withHostHeaderandSSL_8B0C/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;If we try to access the FTP site using an SSL enabled FTP client it will fail as shown below:&lt;/P&gt;
&lt;DIV class=error&gt;
&lt;P&gt;Command:&amp;nbsp;&amp;nbsp;&amp;nbsp; AUTH TLS &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 534-Local policy on server does not allow TLS secure connections. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Win32 error:&amp;nbsp;&amp;nbsp; Access is denied. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Error details: SSL certificate was not configured. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 534 End &lt;BR&gt;Command:&amp;nbsp;&amp;nbsp;&amp;nbsp; AUTH SSL &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 534-Local policy on server does not allow TLS secure connections. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Win32 error:&amp;nbsp;&amp;nbsp; Access is denied. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Error details: SSL certificate was not configured. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 534 End&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp; *Output from Filezilla FTP client&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: AUTH TLS/SSL Negotiation for Primary connection is done based on the certificate at the global level and uses the certificate installed at the site level for Data connection.&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;Some FTP clients like FileZilla require the same SSL certificate to be used for both the control and the data channel. If the certificates don’t match the primary connection will be established but the data transfer connection will be aborted as shown below:&lt;/P&gt;
&lt;DIV class=error&gt;
&lt;P&gt;Command:&amp;nbsp;&amp;nbsp;&amp;nbsp; LIST &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 150 Opening BINARY mode data connection. &lt;BR&gt;Error:&amp;nbsp;&amp;nbsp;&amp;nbsp; Primary connection and data connection certificates don't match. &lt;BR&gt;Error:&amp;nbsp;&amp;nbsp;&amp;nbsp; Transfer connection interrupted: ECONNABORTED - Connection aborted &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 226 Transfer complete. &lt;BR&gt;Error:&amp;nbsp;&amp;nbsp;&amp;nbsp; Failed to retrieve directory listing&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp; *Output from Filezilla FTP client&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;If we have the SSL Certificate only at the global level and not at the FTP site level we will see an error again as below:&lt;/P&gt;
&lt;DIV class=error&gt;
&lt;P&gt;Command:&amp;nbsp;&amp;nbsp;&amp;nbsp; PROT P &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 431-Failed to setup secure session. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Win32 error:&amp;nbsp;&amp;nbsp; &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Error details: SSL certificate hash has invalid length. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 431 End &lt;BR&gt;.... &lt;BR&gt;.... &lt;BR&gt;Command:&amp;nbsp;&amp;nbsp;&amp;nbsp; LIST &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 534-Protection level negotiation failed. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Win32 error:&amp;nbsp;&amp;nbsp; Access is denied. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Error details: Protection negotiation failed. PROT command with recognized parameter must precede this command. &lt;BR&gt;Response:&amp;nbsp;&amp;nbsp;&amp;nbsp; 534 End &lt;BR&gt;Error:&amp;nbsp;&amp;nbsp;&amp;nbsp; Failed to retrieve directory listing &lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp; *Output from FileZilla FTP client&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;So overall, we need to ensure that a valid SSL certificate is set both at the global and the individual FTP site levels. It finally depends upon the FTP client whether to expect the same certificate or different ones for primary and data connections.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;Till next time, &lt;/FONT&gt;&lt;FONT size=1&gt;Saurabh&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9918310" width="1" height="1"&gt;</description></item><item><title>Configuring DebugDiag to Automatically Capture a Full User Dump on a Managed Function</title><link>http://blogs.msdn.com/webtopics/archive/2009/10/01/configuring-debugdiag-to-automatically-capture-a-full-user-dump-on-a-managed-function.aspx</link><pubDate>Thu, 01 Oct 2009 21:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9901991</guid><dc:creator>bretb</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9901991.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9901991</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9901991</wfw:comment><description>&lt;P&gt;I recently worked an issue with a customer where we needed to capture a full user dump of the IIS worker process when a specific function was being called.&amp;nbsp;&amp;nbsp; The problem was that the function was in managed code.&amp;nbsp;&amp;nbsp; I thought it would be good to share how to do this with the Web Topics Community.&amp;nbsp; I will first show how to set a managed breakpoint in a normal debugger.&amp;nbsp; Then I will show how to automate it with DebugDiag, and have it take an action of creating a full user mode dump file when the breakpoint is hit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The managed function I will use to illustrate this is:&lt;/P&gt;
&lt;P&gt;System.Web.HttpResponse.ReportRuntimeError&lt;/P&gt;
&lt;H2&gt;Normal Debugger&lt;/H2&gt;
&lt;P class=code&gt;Load sos.dll: &lt;BR&gt;.loadby sos mscorwks &lt;/P&gt;
&lt;H3&gt;Method 1:&amp;nbsp;Set the Breakpoint with !bpmd&lt;/H3&gt;
&lt;P class=code&gt;0:012&amp;gt; !bpmd System_Web_ni System.Web.HttpResponse.ReportRuntimeError&lt;BR&gt;Found 1 methods...&lt;BR&gt;MethodDesc = 65f688bc&lt;BR&gt;Setting breakpoint: bp 660A27C0 [System.Web.HttpResponse.ReportRuntimeError(System.Exception, Boolean, Boolean)]&lt;/P&gt;
&lt;H3&gt;Method 2:&amp;nbsp; Find the Jitted address and set with bp command&lt;/H3&gt;
&lt;P class=code&gt;0:012&amp;gt; !name2ee System_Web_ni System.Web.HttpResponse.ReportRuntimeError&lt;BR&gt;Module: 65f21000 (System.Web.dll)&lt;BR&gt;Token: 0x060005fb&lt;BR&gt;MethodDesc: 65f688bc&lt;BR&gt;Name: System.Web.HttpResponse.ReportRuntimeError(System.Exception, Boolean, Boolean)&lt;BR&gt;JITTED Code Address: 660a27c0 &lt;BR&gt;0:012&amp;gt; bp 660a27c0 &lt;/P&gt;
&lt;P&gt;When you run the debugger, and it breaks, you can use !clrstack to see the call stack:&lt;/P&gt;
&lt;P class=code&gt;0:003&amp;gt; !clrstack&lt;BR&gt;OS Thread Id: 0x68c (3)&lt;BR&gt;ESP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EIP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;0063f2f0 660a27c0 System.Web.HttpResponse.ReportRuntimeError(System.Exception, Boolean, Boolean)&lt;BR&gt;0063f2fc 66090280 System.Web.HttpRuntime.FinishRequest(System.Web.HttpWorkerRequest, System.Web.HttpContext, System.Exception)&lt;BR&gt;0063f344 660900d6 System.Web.HttpRuntime.OnHandlerCompletion(System.IAsyncResult)&lt;BR&gt;0063f374 6608fafe System.Web.HttpAsyncResult.Complete(Boolean, System.Object, System.Exception, System.Web.RequestNotificationStatus)&lt;BR&gt;0063f394 6608c6e1 System.Web.HttpApplication+ApplicationStepManager.ResumeSteps(System.Exception)&lt;BR&gt;0063f3e4 660808ac System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext, System.AsyncCallback, System.Object)&lt;BR&gt;0063f400 66083e1c System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest)&lt;BR&gt;0063f434 66083ac3 System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest)&lt;BR&gt;0063f444 66082c5c System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr, Int32)&lt;BR&gt;0063f658 79f68cde [ContextTransitionFrame: 0063f658] &lt;BR&gt;0063f68c 79f68cde [GCFrame: 0063f68c] &lt;BR&gt;0063f7e8 79f68cde [ComMethodFrame: 0063f7e8] &lt;BR&gt;&lt;/P&gt;
&lt;P&gt;This can be useful when a particular runtime error is occurring in ASP.NET and you are not sure why.&amp;nbsp;&amp;nbsp; However, attaching a live debugger and running these commands will stop the processing of web requests for the amount of time you spend in the live debugger.&amp;nbsp; Therefore, the following steps will show how to automate this with DebugDiag.&lt;/P&gt;
&lt;H2&gt;Automating a Managed Breakpoint Dump with DebugDiag&lt;/H2&gt;
&lt;P&gt;DebugDiag can be downloaded here:&amp;nbsp; &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;amp;displaylang=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;After Installing DebugDiag, the steps we will take are as follows:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Create a Crash Rule, but do not activate it.&lt;/LI&gt;
&lt;LI&gt;Modify the Crash Rule Script&lt;/LI&gt;
&lt;LI&gt;Activate the Crash Rule&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Create a Crash Rule that is not activated&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;On the rules tab click the Add Rule... button to bring up the Rule creation wizard.&lt;/LI&gt;
&lt;LI&gt;Choose the Crash Rule Option:&lt;BR&gt;&lt;BR&gt;&lt;IMG style="WIDTH: 448px; HEIGHT: 390px" title="Select Rule Type" alt="Select Rule Type" src="http://blogs.msdn.com/photos/bretb_blog_photo_gallery/images/9902052/640x480.aspx" width=448 height=390 mce_src="http://blogs.msdn.com/photos/bretb_blog_photo_gallery/images/9902052/640x480.aspx"&gt;&lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;Choose the option "A specific IIS web application pool"&lt;BR&gt;&lt;BR&gt;&lt;IMG style="WIDTH: 448px; HEIGHT: 390px" title="A Specific Application Pool" alt="A Specific Application Pool" src="http://blogs.msdn.com/photos/bretb_blog_photo_gallery/images/9902053/640x480.aspx" width=448 height=390 mce_src="http://blogs.msdn.com/photos/bretb_blog_photo_gallery/images/9902053/640x480.aspx"&gt;&lt;/&lt; LI&gt; &lt;BR&gt;
&lt;LI&gt;Choose the application pool that will be monitored&lt;BR&gt;&lt;BR&gt;&lt;IMG style="WIDTH: 448px; HEIGHT: 390px" title="Application Pool to Monitor" alt="Application Pool to Monitor" src="http://blogs.msdn.com/photos/bretb_blog_photo_gallery/images/9902050/640x480.aspx" width=448 height=390 mce_src="http://blogs.msdn.com/photos/bretb_blog_photo_gallery/images/9902050/640x480.aspx"&gt;&lt;/&lt; LI&gt; &lt;BR&gt;
&lt;LI&gt;Click next twice to move to the end of the Wizard and choose "Do not activate the rule at this time"&lt;BR&gt;&lt;BR&gt;&lt;IMG style="WIDTH: 448px; HEIGHT: 390px" title="Do not activate rule" alt="Do not activate rule" src="http://blogs.msdn.com/photos/bretb_blog_photo_gallery/images/9902056/640x480.aspx" width=448 height=390 mce_src="http://blogs.msdn.com/photos/bretb_blog_photo_gallery/images/9902056/640x480.aspx"&gt;&lt;/&lt; LI&gt; &lt;BR&gt;
&lt;LI&gt;Click Finish to create the rule&lt;/LI&gt;&lt;/OL&gt;
&lt;H3&gt;Modify the Crash Rule Script&lt;/H3&gt;
&lt;P&gt;The crash rule is a VBS File that will be located in the DebugDiag installation Scripts sub-directory.&amp;nbsp;&amp;nbsp; The VBS File is used when DebugDiag attaches to the IIS worker process for debugging.&amp;nbsp;&amp;nbsp; We will be modifying two functions in this script file. &lt;/P&gt;
&lt;P&gt;Open the script file in notepad or your favorite text editor.&amp;nbsp; It will be named CrashRule_WebAppPool_AppPoolName.vbs.&amp;nbsp; Where the "AppPoolName" part of the file will be the name of the application pool the rule was configured for.&amp;nbsp;&amp;nbsp; Search for Debugger_OnInitialBreakpoint in the script file.&amp;nbsp;&amp;nbsp; This is a function that is called when DebugDiag first attaches to the process.&amp;nbsp; This is where we will add code to set the breakpoint.&amp;nbsp; The function should look like this when completed.&lt;/P&gt;
&lt;P class=code&gt;Sub Debugger_OnInitialBreakpoint()&lt;BR&gt;&amp;nbsp;Dim strRet, strBP, bpCommand&lt;BR&gt;&amp;nbsp;WriteToLog "Initializing control script"&lt;BR&gt;&amp;nbsp;On Error Resume Next&lt;BR&gt;&amp;nbsp;Set ServiceController = CreateObject("DbgSVC.Controller")&lt;BR&gt;&amp;nbsp;Set ServiceState = ServiceController.ServiceState&lt;BR&gt;&amp;nbsp;On Error Goto 0 &amp;nbsp;WriteToLog "Clearing any existing breakpoints"&lt;BR&gt;&amp;nbsp;WriteToLog Debugger.Execute("bc *")&lt;BR&gt;&amp;nbsp;WriteToLog Debugger.Execute(".loadby sos mscorwks")&lt;BR&gt;&amp;nbsp;strRet = Debugger.Execute("!bpmd System_Web_ni System.Web.HttpResponse.ReportRuntimeError")&lt;BR&gt;&amp;nbsp;WriteToLog strRet&lt;BR&gt;&amp;nbsp;WriteToLog "Report Runtime Error BP Configured"&lt;BR&gt;&amp;nbsp;DbgState("BP_RUNTIME_ERROR_COUNT") = 0&lt;BR&gt;&amp;nbsp;WriteToLog "Current Breakpoint List(BL)"&lt;BR&gt;&amp;nbsp;Debugger.Write Debugger.Execute("bl")&lt;BR&gt;End Sub &lt;/P&gt;
&lt;P&gt;We added the following code to load the debugger extension and set the breakpoint.&amp;nbsp; The last line will output the result of the !bpmd command to our log file for our rule.&lt;/P&gt;
&lt;P class=code&gt;&lt;BR&gt;&amp;nbsp;WriteToLog Debugger.Execute(".loadby sos mscorwks")&lt;BR&gt;&amp;nbsp;strRet = Debugger.Execute("!bpmd System_Web_ni System.Web.HttpResponse.ReportRuntimeError")&lt;BR&gt;&amp;nbsp;WriteToLog strRet&lt;BR&gt;&amp;nbsp;WriteToLog "Report Runtime Error BP Configured"&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;Then we added the following we can use to keep track of a dump count for our breakpoint:&lt;/P&gt;
&lt;P class=code&gt;&lt;BR&gt;&amp;nbsp;DbgState("BP_RUNTIME_ERROR_COUNT") = 0&lt;/P&gt;
&lt;P&gt;This will set our breakpoint.&amp;nbsp; When the breakpoint is actually hit, the Debugger_OnBreakpoint event is fired in our script.&amp;nbsp; We will modify this function to handle our breakpoint and generate a full user dump file.&amp;nbsp; We will also hard code a limit of 5 dump files.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;To change the second function, look for Debugger_OnBreakpoint in the script file and re-configure it as follows:&lt;/P&gt;
&lt;P class=code&gt;&lt;BR&gt;Sub Debugger_OnBreakPoint(ByVal BreakPoint, ByVal CausingThread)&lt;BR&gt;&amp;nbsp;WriteToLog "Breakpoint at " &amp;amp; BreakPoint.OffsetExpression &amp;amp; " caused by " &amp;amp; CausingThread.SystemID&lt;BR&gt;&amp;nbsp;If BreakPoint.OffsetExpression = "System.Web.HttpResponse.ReportRuntimeError(System.Exception, Boolean, Boolean)" Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;If DbgState("BP_RUNTIME_ERROR_COUNT") &amp;lt; 5 Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;CreateDump Breakpoint.OffsetExpression, false&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;DbgState("BP_RUNTIME_ERROR_COUNT") = DbgState("BP_RUNTIME_ERROR_COUNT") + 1&lt;BR&gt;&amp;nbsp;&amp;nbsp;End If&lt;BR&gt;&amp;nbsp;End If&lt;BR&gt;End Sub&lt;/P&gt;
&lt;P&gt;Save the script file.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Activate the Crash Rule and verify the breakpoint is set&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Right click&amp;nbsp;the rule in DebugDiag's rule view, and click the Activate Rule menu item.&amp;nbsp;&amp;nbsp; This will activate our rule.&amp;nbsp; But how can we be sure our breakpoint was set?&amp;nbsp;&amp;nbsp; To do this go to the logs folder and open the w3wp__xxx_xxx.txt file that was created for the worker process when the rule was activated.&amp;nbsp;&amp;nbsp; The easiest way to get there is View-&amp;gt;Logs Folder menu in DebugDiag.&amp;nbsp; Locate the w3wp__PID__XXXX__Log.txt file for the PID of the currently running w3wp.exe and open it in notepad.&amp;nbsp;&amp;nbsp; Search for "Report Runtime Error BP Configured" in the log file, and make sure the breakpoint is correct.&amp;nbsp;&amp;nbsp;Here is what it should look like in the log file if it is correct:&lt;/P&gt;
&lt;P class=code&gt;Found 1 methods...&lt;BR&gt;MethodDesc = 65f688bc&lt;BR&gt;Setting breakpoint: bp 660A27C0 [System.Web.HttpResponse.ReportRuntimeError(System.Exception, Boolean, Boolean)]&lt;BR&gt;[10/1/2009 1:22:10 PM] Report Runtime Error BP Configured 
&lt;H2&gt;Conclusions&lt;/H2&gt;
&lt;P&gt;This post explains how to automate a managed breakpoint with DebugDiag to generate a Full User dump when the managed breakpoint is hit.&amp;nbsp; The particular example used can be used to get a full user dump when the System.Web.HttpResponse.ReportRuntimeError function is called.&amp;nbsp; Getting a full user dump when this function is called may help identify why a certain ASP.NET Runtime error occurs.&amp;nbsp; For more information on how to analyze the dumps created please see the following .NET Debugging Demo's on Tess's blog:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/tess/pages/net-debugging-demos-information-and-setup-instructions.aspx"&gt;http://blogs.msdn.com/tess/pages/net-debugging-demos-information-and-setup-instructions.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9901991" width="1" height="1"&gt;</description></item><item><title>A Tale of Two Developers and Visual Studio Sites and Apps</title><link>http://blogs.msdn.com/webtopics/archive/2009/09/30/a-tale-of-two-developers-and-visual-studio-sites-and-apps.aspx</link><pubDate>Wed, 30 Sep 2009 16:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9901301</guid><dc:creator>jamesche</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9901301.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9901301</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9901301</wfw:comment><description>&lt;P&gt;We've encountered several scenarios in which customers have multiple developers working on a single web application in Visual Studio. In such cases, it's not uncommon for each developer to be working on a portion of the application. There isn't any problem in working with this way, but you may encounter some very real problems when you deploy your application unless you plan in advance.&lt;/P&gt;
&lt;H2&gt;The Scenario&lt;/H2&gt;
&lt;P&gt;Suppose you have two developers working on your web application. Developer A (we'll call him John) is working on a forum for the application and developer B (who we'll call Jill) is working on a photo gallery for the site. In order to keep files and folders organized, the forum and the photo gallery will both be contained in their own folders on the final site. In other words, by browsing to www.site.com/forum, users will be able to hit the forum, and by browsing to www.site.com/photogallery, users will hit the photo gallery.&lt;/P&gt;
&lt;P&gt;Jill has created a new web site in Visual Studio called PhotoGallery, and this is where she's going to create her pages for her portion of the application. John has created a new web site called Forum for his portion of the site. Both John and Jill frequently test their code against the ASP.NET Development Server and, after a long period of development, are both ready to deploy to the test web server.&lt;/P&gt;
&lt;P class=ImageCaption&gt;&lt;IMG alt="Jill's part of the web site as shown in Solution Explorer." src="http://www.jimcobooks.com/blog/sitesapps/se.png" width=253 height=361 mce_src="http://www.jimcobooks.com/blog/sitesapps/se.png"&gt;&lt;BR&gt;Jill's PhotoGallery in Solution Explorer&lt;/P&gt;
&lt;P&gt;Jill copies the PhotoGallery folder she created for her portion of the site to the c:\inetpub\wwwroot folder on the server and John copies the Forum folder he created to the wwwroot folder. The resulting directory structure in IIS is shown below.&lt;/P&gt;
&lt;P class=ImageCaption&gt;&lt;IMG alt="Folder structure of deployed site in IIS." src="http://www.jimcobooks.com/blog/sitesapps/iisfolders.png" width=256 height=241 mce_src="http://www.jimcobooks.com/blog/sitesapps/iisfolders.png"&gt;&lt;BR&gt;Folder Structure in IIS&lt;/P&gt;
&lt;P&gt;Everything looks fine with this scenario so far, but as soon as either John or Jill attempts to access his or her portion of the site, something bad happens as shown below.&lt;/P&gt;
&lt;P class=ImageCaption&gt;&lt;IMG alt="An error occurs when the photogallery folder is browsed." src="http://www.jimcobooks.com/blog/sitesapps/error.png" width=704 height=614 mce_src="http://www.jimcobooks.com/blog/sitesapps/error.png"&gt;&lt;BR&gt;An error occurs when John or Jill browse the site.&lt;/P&gt;
&lt;H2&gt;The Problem&lt;/H2&gt;
&lt;P&gt;The problem here is that Visual Studio expects that the web sites that John and Jill created are &lt;EM&gt;application roots&lt;/EM&gt; in IIS. An application root in IIS is a folder that is marked as an application. When a folder is marked as an application, the folder's icon appears as a globe with a page on it as shown below.&lt;/P&gt;
&lt;P class=ImageCaption&gt;&lt;IMG alt="An application in IIS." src="http://www.jimcobooks.com/blog/sitesapps/app.png" width=352 height=375 mce_src="http://www.jimcobooks.com/blog/sitesapps/app.png"&gt;&lt;BR&gt;An Application in IIS.&lt;/P&gt;
&lt;P class=note&gt;&lt;SPAN style="FONT-SIZE: large"&gt;&lt;STRONG&gt;Important&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR&gt;I converted the "forum" folder into an application for the figure above simply so that I could show you what the icon looks like. The act of copying a folder to IIS will &lt;EM&gt;not &lt;/EM&gt;make a folder an application in IIS.&lt;/P&gt;
&lt;P&gt;Since John and Jill simply copied folders into IIS, the applications they each created in Visual Studio are simply folders in IIS (like the photogallery folder in the figure above) and are not recognized as applications. Because ASP.NET does not allow for certain settings to be configured in a subdirectory of an application, both John and Jill see an error when browsing their portion of the site.&lt;/P&gt;
&lt;P&gt;Keep in mind that this is only one example of the kind of problem you can encounter in this scenario. For example, if the root of your site was created in Visual Studio as a web application instead of a web site and developers copy web sites from Visual Studio into that directory structure, you can end up with more problems that are tough to solve. &lt;/P&gt;
&lt;P class=note&gt;&lt;SPAN style="FONT-SIZE: large"&gt;&lt;STRONG&gt;More Info&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR&gt;See &lt;A href="http://msdn.microsoft.com/en-us/library/aa983474.aspx" mce_href="http://msdn.microsoft.com/en-us/library/aa983474.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa983474.aspx&lt;/A&gt; on MSDN for an explanation of web sites vs. web applications in Visual Studio.&lt;/P&gt;
&lt;H2&gt;The Solution&lt;/H2&gt;
&lt;P&gt;How can John and Jill solve the error message they are seeing? They could simply convert the folders that they copied to IIS into application roots, but while doing so would get rid of the error, it would likely introduce other problems. For example, there Application and Session variables are specific to an application, so if both the photogallery and forum folders were marked as application roots, Application and Session variables couldn't be shared between them. Also, as we saw in the error that Jill saw in the browser, authentication modes are specific to an application. Therefore, if the site as a whole relies on ASP.NET Forms authentication, mucking around with application roots can break authentication.&lt;/P&gt;
&lt;P&gt;A good approach to the problem that John and Jill are encountering is to change the way that they both develop the site in Visual Studio. Each should develop against a web site in Visual Studio called &lt;EM&gt;site.com &lt;/EM&gt;and create a folder within that site for the part of the application they are developing. The resulting project structure in Visual Studio's Solution Explorer is shown below.&lt;/P&gt;
&lt;P class=ImageCaption&gt;&lt;IMG alt="The right way to create the site in Visual Studio." src="http://www.jimcobooks.com/blog/sitesapps/rightway.png" width=253 height=305 mce_src="http://www.jimcobooks.com/blog/sitesapps/rightway.png"&gt;&lt;BR&gt;The right way to create the site in Visual Studio.&lt;/P&gt;
&lt;P&gt;If your team consists of multiple developers and you want to ensure that you control who is working on particular parts of the project, it's wise to have your developers work off of a common site.com folder and use a source control system like TFS to check out the content that he or she needs to develop. If you don't have a source control system, you'll want to make sure that the web.config file in the site.com folder is the same for each developer and it's a good idea for each developer to change only files in his or her particular subfolder for the app.&lt;/P&gt;
&lt;H2&gt;The Terminology Can Cause Confusion&lt;/H2&gt;
&lt;P&gt;It's important that you understand the terminology involved in this kind of scenario. For example, Visual Studio can create an ASP.NET web site or an ASP.NET web application. An ASP.NET web site is not the same thing as a web site in IIS, and an ASP.NET web application is not the same as an application in IIS. I realize that's a bit confusing, so here's some information that might help to clear things up.&lt;/P&gt;
&lt;H3&gt;Web Site in Visual Studio&lt;/H3&gt;
&lt;P&gt;Web sites in Visual Studio were introduced with Visual Studio 2005. There is no project files in a web site (no .csproj or .vbproj) and the location for the web site can be anywhere on a disk. There is not a &lt;EM&gt;References&lt;/EM&gt; folder in Solution Explorer when working with web sites. Instead, you set refereces in the Property Pages for the site. You are also not required to build (compile) a web site prior to running it. All of that takes place dynamically.&lt;/P&gt;
&lt;P&gt;You create an ASP.NET web site in Visual Studio by selecting &lt;STRONG&gt;File&lt;/STRONG&gt;, &lt;STRONG&gt;New Web Site&lt;/STRONG&gt;.&lt;/P&gt;
&lt;H3&gt;Web Site in IIS&lt;/H3&gt;
&lt;P&gt;A web site in IIS is a node that is identified by its bindings. By default, there is one web site called Default Web Site with an HTTP binding all IPs to port 80. If you want to create a new web site, you would have to create a new binding to either a different port, a different IP, etc. &lt;/P&gt;
&lt;P&gt;As you can see &lt;EM&gt;web site&lt;/EM&gt; in Visual Studio is completely unrelated to &lt;EM&gt;web site&lt;/EM&gt; in IIS.&lt;/P&gt;
&lt;H3&gt;Web Application in Visual Studio&lt;/H3&gt;
&lt;P&gt;A web application in Visual Studio uses the same model that was used for ASP.NET projects in Visual Studio .NET 2003. It was then reintroduced for Visual Studio 2005 as an add-on called Web Application Projects. That add-on became a full-fledged component of Visual Studio 2005 in SP1 and remains a component of Visual Studio 2008.&lt;/P&gt;
&lt;P&gt;When the application is created, a project file is created along with the other files for the project. A gray-colored &lt;EM&gt;References&lt;/EM&gt; folder appears in Solution Explorer so that you can review project references and/or add your own. There is also a special folder called &lt;EM&gt;Properties &lt;/EM&gt;that contains the AssemblyInfo.cs or AssemblyInfo.vb file for the project. When you're ready to run the application, you must first compile it from the Build menu.&lt;/P&gt;
&lt;P&gt;You create an ASP.NET web site in Visual Studio by selecting &lt;STRONG&gt;File&lt;/STRONG&gt;, &lt;STRONG&gt;New Project&lt;/STRONG&gt;.&lt;/P&gt;
&lt;H3&gt;Web Application in IIS&lt;/H3&gt;
&lt;P&gt;A web application in IIS is a node that has been marked as an application. An application in IIS is the level at which you would place your global.asax file. ASP.NET authentication methods (i.e. Windows, Forms, etc.) can be specificed at this level, but not lower in the hierarchy. Session variables and Forms authentication tickets are isolated to a web application in IIS.&lt;/P&gt;
&lt;P&gt;As you can see a &lt;EM&gt;web application&lt;/EM&gt; in Visual Studio is completely unrelated to a &lt;EM&gt;web application&lt;/EM&gt; in IIS.&lt;/P&gt;
&lt;H2&gt;Final Thoughts&lt;/H2&gt;
&lt;P&gt;We worked with a customer at one point who had created a web application in Visual Studio that would eventually be deployed to the Default Web Site in IIS. During development, some of the developers who were creating portions of this site determined that they'd better create web sites in Visual Studio for their portion of the site because they new that this was eventually going to be deployed to a web site. &lt;/P&gt;
&lt;P&gt;On the day of deployment, someone realized that the main project for the site was a web application, so they began the process of trying to convert the Visual Studio web application to a Visual Studio web site. In fact, we have &lt;A href="http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx" mce_href="http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx"&gt;thorough documentation&lt;/A&gt; about how to convert a web site to a web application, but going the other way is another matter altogether. The customers projects was huge, made up of thousands of pages and folders. After they had spent a considerable amount of time trying this on their own, they called us.&lt;/P&gt;
&lt;P&gt;Getting everything back to working order took days of work, much of which was spent with the customer frustrated over a seemingly endless number of exceptions. Fix one exception and 200 others spring up to take its place. It's grueling work, and it was all the result of misunderstanding the terms and drawing correlations where none exists.&lt;/P&gt;
&lt;P&gt;Hopefully the information I've provided here can help you to avoid a similar pitfall. Plan your projects carefully with deployment in mind, and make sure that you understand the fact that even though IIS and Visual Studio use some of the same terms, those terms mean something entirely different in each context.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9901301" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>ASP.NET MVC: What is it and should I use it?</title><link>http://blogs.msdn.com/webtopics/archive/2009/09/01/asp-net-mvc-what-is-it-and-should-i-use-it.aspx</link><pubDate>Tue, 01 Sep 2009 22:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9890048</guid><dc:creator>jamesche</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9890048.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9890048</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9890048</wfw:comment><description>&lt;P&gt;In March of this year, we released ASP.NET MVC. Since then, many ASP.NET developers have been perplexed about MVC. Many developers aren't quite sure what MVC is and what it means for ASP.NET developers. Many more developers have some level of understanding when it comes to MVC but are not sure when it should be used and why. This post will hopefully shed some light on some of the confusion surrounding MVC.&lt;/P&gt;
&lt;P class=note&gt;&lt;SPAN style="FONT-SIZE: large"&gt;&lt;STRONG&gt;More Info&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR&gt;You can download ASP.NET MVC from the &lt;A href="http://www.asp.net/mvc" target=_blank mce_href="http://www.asp.net/mvc"&gt;ASP.NET MVC site&lt;/A&gt;. A more convenient means of downloading MVC and other Microsoft Web technologies is the Web Platform Installer available &lt;A href="http://www.microsoft.com/web/downloads/platform.aspx" target=_blank mce_href="http://www.microsoft.com/web/downloads/platform.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;H2&gt;A Brief Overview of ASP.NET MVC&lt;/H2&gt;
&lt;P&gt;ASP.NET MVC is a framework that adds support for the MVC design pattern to ASP.NET. Therefore, in order to really understand what ASP.NET MVC is, you need to first understand what MVC is.&lt;/P&gt;
&lt;P&gt;MVC is an acronym that stands for Model / View / Controller. MVC is a programming architecture that aids developers with separating different components of an application. Let's review each component of MVC individually as they relate to ASP.NET MVC.&lt;/P&gt;
&lt;H3&gt;The Model&lt;/H3&gt;
&lt;P&gt;The model in an MVC application stores the application data or state of the application. The model is often a database, an XML file, etc. However, because the model is designed to encapsulate the data layer in the application, you will typically not see the data source correlated with the model with regards to MVC. &lt;/P&gt;
&lt;P&gt;In an ASP.NET MVC application, the model typically uses LINQ to SQL or LINQ to Entities.&lt;/P&gt;
&lt;H3&gt;The View&lt;/H3&gt;
&lt;P&gt;The view is the user interface that your site visitors to see data from your model. In an ASP.NET MVC application, web forms (ASPX pages) are typically used to display the view, but there's a significant difference between an MVC view's page and a typical ASP.NET web form. Most specifically, an MVC view doesn't use the typical postback model and the page lifecycle that you are used to when using web forms doesn't exist with MVC views.&lt;/P&gt;
&lt;P class=note&gt;&lt;SPAN style="FONT-SIZE: large"&gt;&lt;STRONG&gt;More Info&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;BR&gt;You don't have to use ASP.NET web forms as the view engine for MVC. Check out &lt;A href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=MVCContrib" target=_blank mce_href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=MVCContrib"&gt;MVC Contrib on CodePlex&lt;/A&gt; for more information.&lt;/P&gt;
&lt;P&gt;It's easy to make the mistake of thinking of the view as the component in MVC that handles user input and controls the interaction with the user. In fact, it's the controller that takes on this role. The view is strictly limited to displaying data from the model.&lt;/P&gt;
&lt;H3&gt;The Controller&lt;/H3&gt;
&lt;P&gt;The controller is responsible for handling the interaction with the user, for communicating with the model, and for determining which view to display to the user. The controller is derived from System.Web.Mvc.Controller.&lt;/P&gt;
&lt;P&gt;The controller defines one or more &lt;EM&gt;actions&lt;/EM&gt; that can be invoked using a URL entered into a web browser. For example, consider the following URL:&lt;/P&gt;
&lt;P&gt;http://www.mysite.com/products/display/43&lt;/P&gt;
&lt;P&gt;A request such as this one would be handed off to the ProductsController where the &lt;EM&gt;display&lt;/EM&gt; action would be invoked. In this particular case, that action might then display a view of product number 43. The routing of the URL to a particular controller is configured using &lt;EM&gt;routes&lt;/EM&gt; that are defined in the global.asax of the MVC application.&lt;/P&gt;
&lt;P class=note&gt;&lt;SPAN style="FONT-SIZE: large"&gt;&lt;STRONG&gt;More Info&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR&gt;For more detailed information on controllers and actions, see &lt;A href="http://msdn.microsoft.com/en-us/library/dd410269.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd410269.aspx"&gt;the MSDN documentation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;What exactly is an action? An action is simply a method of the controller class that meets a few specific requirements.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;An action method must be public&lt;/LI&gt;
&lt;LI&gt;An action method cannot be overloaded&lt;/LI&gt;
&lt;LI&gt;An action method cannot be static&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=note&gt;&lt;SPAN style="COLOR: #ff0000; FONT-SIZE: large"&gt;&lt;STRONG&gt;Warning&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;BR&gt;It's important to keep security in mind when developing your action methods. For example, based on the above URL, one could conclude that browsing to http://www.mysite.com/products/delete/43 would delete product number 43! The Authorize attribute can be used to restrict access to a controller's actions. See &lt;A href="http://msdn.microsoft.com/en-us/library/dd381413.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd381413.aspx"&gt;http://msdn.microsoft.com/en-us/library/dd381413.aspx&lt;/A&gt; for more information.&lt;/P&gt;
&lt;H2&gt;Benefits of MVC&lt;/H2&gt;
&lt;P&gt;In order to maintain state in an ASP.NET web forms application, ASP.NET uses encoded data in a hidden form field via a feature called &lt;EM&gt;viewstate&lt;/EM&gt;. Viewstate does pretty well at providing the illusion of a stateful application, but there are times when problems are encountered. For example, in large applications, viewstate can become very large. Large viewstate not only increases your payload across the network, but it can also impact your search engine ranking by pushing readable page content far down in the rendered code. &lt;/P&gt;
&lt;P class=note&gt;&lt;SPAN style="FONT-SIZE: large"&gt;&lt;STRONG&gt;More Info&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR&gt;The problem of large viewstate was greatly improved in ASP.NET 2.0, and you can expect even more improvements in ASP.NET 4.0.&lt;/P&gt;
&lt;P&gt;ASP.NET web forms developers also have to take the page lifecycle into account, and dealing with &lt;EM&gt;when&lt;/EM&gt; to do certain things can be as much or more frustrating than figuring out &lt;EM&gt;how&lt;/EM&gt; to do something. MVC does away with this kind of frustration because it is truly stateless. Postbacks and the web forms page lifecycle no longer exist. &lt;/P&gt;
&lt;P&gt;Another advantage when using MVC is that it allows for full control over the rendered HTML. In a web forms application, HTML code is rendered in large part by server controls, and developers have relatively little control over the code that is generated. The HTML code in an MVC view, on the other hand, is entirely controlled by the developer of the view. &lt;/P&gt;
&lt;P&gt;MVC also lends itself well to a separated approach to development. One developer can work on the controller class while another developer works on the view. This design methodology also aids in testing. It's extremely difficult to test one particular piece of a web forms application because of the reliance of all of the other controls on the page and the managed runtime. An MVC application can be tested much more easily and efficiently because the model, the view, and the controller are all separate components.&lt;/P&gt;
&lt;P class=note&gt;&lt;SPAN style="FONT-SIZE: large"&gt;&lt;STRONG&gt;More Info&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR&gt;You can find a great overview of the benefits and drawbacks of both MVC and web forms in &lt;A href="http://msdn.microsoft.com/en-us/magazine/dd942833.aspx#id0080017" target=_blank mce_href="http://msdn.microsoft.com/en-us/magazine/dd942833.aspx#id0080017"&gt;Dino Esposito's Cutting Edge article&lt;/A&gt;. More great information is available on Shiju Varghese's &lt;A href="http://weblogs.asp.net/shijuvarghese/archive/2008/07/09/asp-net-mvc-vs-asp-net-web-form.aspx" target=_blank mce_href="http://weblogs.asp.net/shijuvarghese/archive/2008/07/09/asp-net-mvc-vs-asp-net-web-form.aspx"&gt;blog post&lt;/A&gt;.&lt;/P&gt;
&lt;H2&gt;MVC or Web Forms?&lt;/H2&gt;
&lt;P&gt;Now that you've got a basic understanding of what ASP.NET MVC is and what it offers, you may be wondering if MVC is the way to go with your future ASP.NET applications. Let's look at a few scenarios that might help you decide if MVC is right for your next ASP.NET project.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Choose MVC if . . . &lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You are well-versed in the architecture of MVC. If you aren't comfortable with how to design a controller, MVC probably isn't a good choice.&lt;/LI&gt;
&lt;LI&gt;You want full control over the HTML that is rendered in the browser and you can afford the development time and overhead to do all of your own markup.&lt;/LI&gt;
&lt;LI&gt;You need to create efficient unit tests for your user interface without the overhead of the entire managed runtime, etc.&lt;/LI&gt;
&lt;LI&gt;You want full control over how your URLs are formed.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Choose web forms if . . .&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You are not familiar with designing MVC applications.&lt;/LI&gt;
&lt;LI&gt;You need to minimize development time.&lt;/LI&gt;
&lt;LI&gt;You want a feature-rich user-interface (such as GridViews, etc.) to display data with rich interaction without substantial development investment.&lt;/LI&gt;
&lt;LI&gt;You are already invested in server controls, either from your own development or from 3rd parties.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;These are just a few of the reasons why you might choose one framework over another. Obviously, no one can tell you what decision to make for your application. Ultimately, the decision is up to you, but hopefully the information I've provided here (along with some good links) will help you to decide as you approach your next project.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9890048" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>High memory in IIS due to scriptproxy.dll</title><link>http://blogs.msdn.com/webtopics/archive/2009/08/18/high-memory-in-iis-due-to-scriptproxy-dll.aspx</link><pubDate>Wed, 19 Aug 2009 00:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9874588</guid><dc:creator>Mike Laing</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9874588.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9874588</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9874588</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;One of my customers had a problem on his IIS server, where the IIS process hosting his web application was suffering from very high memory utilization over time.&amp;nbsp; Eventually the process got so high in memory that the web application became completely unresponsive and incoming requests were no longer getting served.&amp;nbsp; Based on these details, we began troubleshooting the issue as a memory leak/high memory issue.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;The first step was to capture a memory dump of the problematic process, when its memory usage was at its worst point.&amp;nbsp; The customer had actually already captured the memory dump before calling, so we moved to the next step immediately: data analysis.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;NOTE: The customer had not used the Debug Diagnostics tool to capture the dump file.&amp;nbsp; The Debug Diagnostics tool is able to capture specific memory leak data which would have made the analysis much easier.&amp;nbsp; However, in this instance we were still able to get to the root cause even without the leak tracking functionality.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;BR&gt;The dump files showed the CRuntime heap growing with various allocation sizes and various number of allocations. If we looked specifically at the allocation groups, we could see that some contained data while others contained pointers to objects. Generally, large allocations contained the data (such as a 100k ASP response) and smaller allocations contained pointers (such as a pointer to a script object). &lt;BR&gt;&lt;BR&gt;Here is a snippet from one of the larger allocations and the data it contained:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'"&gt;0:000&amp;gt; dc&lt;BR&gt;098b0080 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b0090 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b00a0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b00b0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b00c0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b00d0 002a002a 002a002a 002a002a 000a000d *.*.*.*.*.*.....&lt;BR&gt;098b00e0 00200027 00750050 00700072 0073006f '. .P.u.r.p.o.s.&lt;BR&gt;098b00f0 003a0065 00530009 00740065 00200073 e.:...S.e.t.s. .&lt;BR&gt;0:000&amp;gt; &lt;BR&gt;098b0100 006c0061 0020006c 00740073 006e0061 a.l.l. .s.t.a.n.&lt;BR&gt;098b0110 00610064 00640072 00700020 00670061 d.a.r.d. .p.a.g.&lt;BR&gt;098b0120 00200065 006e0069 006f0066 006d0072 e. .i.n.f.o.r.m.&lt;BR&gt;098b0130 00740061 006f0069 000d006e 0027000a a.t.i.o.n.....'.&lt;BR&gt;098b0140 000a000d 00200027 006e0049 00750070 ....'. .I.n.p.u.&lt;BR&gt;098b0150 00730074 0009003a 006f006e 0065006e t.s.:...n.o.n.e.&lt;BR&gt;098b0160 000a000d 000d0027 0027000a 00520020 ....'.....'. .R.&lt;BR&gt;098b0170 00740065 00720075 0073006e 0009003a e.t.u.r.n.s.:...&lt;BR&gt;0:000&amp;gt; &lt;BR&gt;098b0180 006f006e 0065006e 000a000d 002a0027 n.o.n.e.....'.*.&lt;BR&gt;098b0190 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b01a0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b01b0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b01c0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b01d0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b01e0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b01f0 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;0:000&amp;gt; &lt;BR&gt;098b0200 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b0210 002a002a 002a002a 002a002a 002a002a *.*.*.*.*.*.*.*.&lt;BR&gt;098b0220 000a000d 00090027 0070006f 00690074 ....'...o.p.t.i.&lt;BR&gt;098b0230 006e006f 00650020 00700078 0069006c o.n. .e.x.p.l.i.&lt;BR&gt;098b0240 00690063 000d0074 0072000a 00730065 c.i.t.....r.e.s.&lt;BR&gt;098b0250 006f0070 0073006e 002e0065 00750062 p.o.n.s.e...b.u.&lt;BR&gt;098b0260 00660066 00720065 003d0020 00740020 f.f.e.r. .=. .t.&lt;BR&gt;098b0270 00750072 000d0065 0027000a 00750020 r.u.e.....'. .u.&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;And here is a sample of one of the smaller allocations (16 bytes each):&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'"&gt;&lt;BR&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'"&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;BR&gt;030c2f00 18036524 00000000 0315cfd8 00000000 $e..............&lt;BR&gt;030c2f10 00030007 00080101 09c242e0 140bc5b8 .........B......&lt;BR&gt;030c2f20 00000000 00000000 0b3efb7c 00000042 ........|.&amp;gt;.B...&lt;BR&gt;030c2f30 00000005 1c284fc8 a15ac8d4 00000000 .....O(...Z.....&lt;BR&gt;030c2f40 030d7178 52495748 00070039 00080101 xq..HWIR9.......&lt;BR&gt;030c2f50 6b658ba8 6b658b90 6b658b7c 6b658b64 ..ek..ek|.ekd.ek&lt;BR&gt;030c2f60 6b658b4c 6b658b38 6b658b28 6b658af4 L.ek8.ek(.ek..ek&lt;BR&gt;030c2f70 6b658ae4 6b658ad4 6b658ac4 6b658aac ..ek..ek..ek..ek&lt;BR&gt;dc 0x030c33b0+0x8&lt;BR&gt;030c33b8 18036524 00000000 09c31ab8 06a8d500 $e..............&lt;BR&gt;030c33c8 00000000 00000000 00040003 00080101 ................&lt;BR&gt;030c33d8 18036524 00000000 0a09ba90 00000000 $e..............&lt;BR&gt;030c33e8 00030007 00080101 41d8ff20 00000000 ........ ..A....&lt;BR&gt;030c33f8 00000000 00000000 0b62065c 0000004a ........\.b.J...&lt;BR&gt;030c3408 00000000 6bba0068 1a858c47 00000000 ....h..kG.......&lt;BR&gt;030c3418 00000800 00000000 00070005 00080101 ................&lt;BR&gt;030c3428 00000190 00000000 0311a750 00000000 ........P.......&lt;BR&gt;dc 0x030c33d0+0x8&lt;BR&gt;030c33d8 18036524 00000000 0a09ba90 00000000 $e..............&lt;BR&gt;030c33e8 00030007 00080101 41d8ff20 00000000 ........ ..A....&lt;BR&gt;030c33f8 00000000 00000000 0b62065c 0000004a ........\.b.J...&lt;BR&gt;030c3408 00000000 6bba0068 1a858c47 00000000 ....h..kG.......&lt;BR&gt;030c3418 00000800 00000000 00070005 00080101 ................&lt;BR&gt;030c3428 00000190 00000000 0311a750 00000000 ........P.......&lt;BR&gt;030c3438 00000000 030c4f20 00000000 00000000 .... O..........&lt;BR&gt;030c3448 00050003 00080101 18036524 00000000 ........$e......&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;BR&gt;In the large allocations we could actually see the data in a readable format. It was an ASP script sample, from one of the ASP template objects. But looking at the smaller allocations we saw that the data was in HEX, and there was a repeating 1st parameter of 18036524. This first parameter gave us a good clue as to what allocated the memory; looking at the location that the memory address pointed to, we see it was a function of the component Scriptproxy.dll:&lt;BR&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'"&gt;0:000&amp;gt; dds 18036524 &lt;BR&gt;18036524 18031000 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;+0x1000&lt;BR&gt;18036528 180310b0 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;+0x10b0&lt;BR&gt;1803652c 180310e0 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;+0x10e0&lt;BR&gt;18036530 180310f0 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;+0x10f0&lt;BR&gt;18036534 18031160 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;+0x1160&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;dc 0x04bccbb0+0x8&lt;BR&gt;04bccbb8 18036cd0 18036cb8 18036ca8 18036c94 .l...l...l...l..&lt;BR&gt;04bccbc8 18036c80 18036c68 05872ad8 05872ad8 .l..hl...*...*..&lt;BR&gt;04bccbd8 05872adc 00000000 00000000 05872ae0 .*...........*..&lt;BR&gt;04bccbe8 00000000 05866218 04bccc00 07e42008 .....b....... ..&lt;BR&gt;04bccbf8 00000000 00000000 00000000 00000000 ................&lt;BR&gt;04bccc08 00000000 00000000 00000000 00000000 ................&lt;BR&gt;04bccc18 00000000 00000000 00000000 00000000 ................&lt;BR&gt;04bccc28 00000000 00000000 00000000 00000000 ................&lt;BR&gt;dc 0x04bccfc8+0x8&lt;BR&gt;04bccfd0 18036cd0 18036cb8 18036ca8 18036c94 .l...l...l...l..&lt;BR&gt;04bccfe0 18036c80 18036c68 05872910 05872910 .l..hl...)...)..&lt;BR&gt;04bccff0 05872914 00000000 00000000 00000000 .)..............&lt;BR&gt;04bcd000 00000000 07dd5398 626f2000 04bd0cf0 .....S... ob....&lt;BR&gt;04bcd010 00000000 00000000 00000000 00000000 ................&lt;BR&gt;04bcd020 00000000 00000000 00000000 00000000 ................&lt;BR&gt;04bcd030 00000000 00000000 00000000 00000000 ................&lt;BR&gt;04bcd040 00000000 00000000 00000000 00000000 ................&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;:000&amp;gt; dds 18036cd0&lt;BR&gt;18036cd0 18031f30 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0x850&lt;BR&gt;18036cd4 180320f0 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xa10&lt;BR&gt;18036cd8 18032590 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xeb0&lt;BR&gt;18036cdc 18032110 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xa30&lt;BR&gt;18036ce0 18032130 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xa50&lt;BR&gt;18036ce4 18032150 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xa70&lt;BR&gt;18036ce8 18032170 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xa90&lt;BR&gt;18036cec 18032190 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xab0&lt;BR&gt;18036cf0 180321b0 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xad0&lt;BR&gt;18036cf4 180321d0 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xaf0&lt;BR&gt;18036cf8 18032200 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xb20&lt;BR&gt;18036cfc 18032220 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xb40&lt;BR&gt;18036d00 18032240 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xb60&lt;BR&gt;18036d04 18032260 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xb80&lt;BR&gt;18036d08 18032280 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xba0&lt;BR&gt;18036d0c 180322a0 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;!DllGetClassObject+0xbc0&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;BR&gt;From this data we could see that a component called &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;B&gt;dll&lt;/B&gt; appeared to be allocating memory to store instances of its class object, and appeared to be populating its class objects with the ASP template data.&amp;nbsp; Unfortunately, the memory it was allocating was not ever being released, which was resulting in the high memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 12pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Because Scriptproxy.dll is not a Microsoft component, we were not able to discern from the memory dump why it was acting this way, nor whether this was expected behavior.&amp;nbsp; The easiest was to resolve the customer’s high memory problem quickly was to remove the Scriptproxy.dll component and disable it from loading in the IIS processes.&amp;nbsp; Once the customer did that, the memory problem no longer occurred.&amp;nbsp; I then suggested to the customer that they follow up with the vendor of Scriptproxy.dll for further assistance, since really they would be the experts and would know why Scriptproxy.dll was behaving this way.&amp;nbsp; The &lt;B&gt;lm&lt;/B&gt; command inside the windbg debugger can be used to show details about a component, so I ran it against Scriptproxy to get the vendor info:&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 12pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'"&gt;0:000&amp;gt; lmvm &lt;STRONG&gt;&lt;SPAN class=keywordhighlight1&gt;scriptproxy&lt;/SPAN&gt;&lt;BR&gt;&lt;/STRONG&gt;start end module name&lt;BR&gt;18030000 1803b000 &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt; (deferred) &lt;BR&gt;Image path: C:\Program Files\Network Associates\VirusScan\&lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;.dll&lt;BR&gt;Image name: &lt;SPAN class=keywordhighlight1&gt;&lt;STRONG&gt;scriptproxy&lt;/STRONG&gt;&lt;/SPAN&gt;.dll&lt;BR&gt;Timestamp: Thu Nov 11 12:31:26 2004 (4193CC1E)&lt;BR&gt;CheckSum: 00000000&lt;BR&gt;ImageSize: 0000B000&lt;BR&gt;File version: 8.0.0.955&lt;BR&gt;Product version: 8.0.0.0&lt;BR&gt;File flags: 0 (Mask 3F)&lt;BR&gt;File OS: 40004 NT Win32&lt;BR&gt;File type: 2.0 Dll&lt;BR&gt;File date: 00000000.00000000&lt;BR&gt;Translations: 0000.04b0&lt;BR&gt;CompanyName: Network Associates, Inc.&lt;BR&gt;ProductName: VirusScan Enterprise&lt;BR&gt;ProductVersion: 8.0.0&lt;BR&gt;FileVersion: 8.0.0.955&lt;BR&gt;PrivateBuild: VSE.8.0.0.955 F1&lt;BR&gt;FileDescription: VirusScan Script Proxy&lt;BR&gt;LegalCopyright: Copyright© 1995-2004 Networks Associates Technology, Inc. All &lt;BR&gt;Rights Reserved.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;My customer did get back to me after speaking with the vendor, and it turns out that they had seen these types of issues before with Scriptproxy when it was run on server application platforms that relied on script processing.&amp;nbsp; They also pointed to some publicly available documentation, &lt;A href="https://kc.mcafee.com/corporate/index?page=content&amp;amp;id=KB55963" mce_href="https://kc.mcafee.com/corporate/index?page=content&amp;amp;id=KB55963"&gt;&lt;FONT color=#800080&gt;https://kc.mcafee.com/corporate/index?page=content&amp;amp;id=KB55963&lt;/FONT&gt;&lt;/A&gt;, to assist our customer further.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9874588" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/High+Memory/default.aspx">High Memory</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Deadlock when storing Asp.net sessions in SQL server during peak load</title><link>http://blogs.msdn.com/webtopics/archive/2009/08/12/deadlock-when-storing-asp-net-sessions-in-sql-server-during-peak-load.aspx</link><pubDate>Wed, 12 Aug 2009 21:35:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9867230</guid><dc:creator>jaskis</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9867230.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9867230</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9867230</wfw:comment><description>&lt;p&gt;&lt;font size="2"&gt;When there is more than 1 server in web farm scenario it is an obvious choice to go for session out-of-proc either with SQL server or State server. While storing session with SQLServer if you see issues with SQL deadlock during peak loads involving &lt;strong&gt;DeleteExpiredSessions&lt;/strong&gt; . It goes like this…&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Looking at the current implementation of the &lt;strong&gt;DeleteExpiredSessions&lt;/strong&gt; stored procedure: &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;i&gt;CREATE PROCEDURE DeleteExpiredSessions&lt;/i&gt;       &lt;br /&gt;&lt;i&gt;AS&lt;/i&gt;&amp;#160; &lt;br /&gt;&lt;i&gt;&amp;#160; DECLARE @now DATETIME&lt;/i&gt;&amp;#160; &lt;br /&gt;&lt;i&gt;&amp;#160; SET @now = GETUTCDATE()&lt;/i&gt;&amp;#160; &lt;br /&gt;&lt;i&gt;&amp;#160; DELETE ASPState.dbo.ASPStateTempSessions&lt;/i&gt;&amp;#160; &lt;br /&gt;&lt;i&gt;&amp;#160; WHERE Expires &amp;lt; @now&lt;/i&gt;&amp;#160; &lt;br /&gt;&lt;i&gt;&amp;#160; RETURN 0&lt;/i&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;i&gt;GO&lt;/i&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;This would take the locks on all the expired records for deletion and these locks may be promoted to page locks. This can give rise to deadlocks with other ‘session state write statements’ when the number of records marked for deletion increases. By default this stored procedure is supposed &lt;b&gt;to run every minute.&lt;/b&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;For Example: In one of the case. Looking at no. of records which are marked for deletion&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Select count (*) from ASPState.dbo.ASPStateTempSessions&amp;#160; WHERE Expires &amp;lt; getdate() &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The number of record marked for expiry was &lt;strong&gt;138,000 out of 146,000 records and the size of “ASPStateTempSessions” table was crossing ~20 GB!!&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Next step was to check &lt;b&gt;the session timeout value which&lt;/b&gt; can play a vital role in mitigating the problem. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;If we have timeout value set to a high value (Which in my case was set at: 360 min) then no matter how many times “DeleteExpiredSessions” runs, it won't be able to delete records resulting in a pile-up and hence deadlock. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In a different case I found the session timeout value was set to 60 mins and we could not reduce to default 20 mins due to business requirement .Then we suggested &lt;strong&gt;to change the “DeleteExpiredSessions” stored procedure implementation as mentioned&lt;/strong&gt; in the &lt;/font&gt;&lt;a href="http://msmvps.com/blogs/greglow/archive/2007/02/04/improving-asp-net-session-state-database-performance-by-reducing-blocking.aspx"&gt;&lt;font size="2"&gt;blog&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. (Tweaking is not recommended as you would run out of support boundaries. )&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Another option is to &lt;strong&gt;reduce amount of data&lt;/strong&gt; stored in Session (sessions are meant to store small things like ID’s) and lastly &lt;strong&gt;increase the number of servers&lt;/strong&gt; in SQL environment to handle high load that can help in reducing chances of deadlock. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In &lt;/font&gt;&lt;a href="http://www.asp.net/learn/whitepapers/aspnet40/"&gt;&lt;font size="2"&gt;ASP.NET 4.0&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; the “DeleteExpiredSessions” stored procedure has already been modified using the same approach so that it does not hold any locks on table level and we delete the records individually. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Also it introduces a new compression option for both the “out-of-process session-state” providers. When the “CompressionEnabled” configuration option is set to true, ASP.NET will compress (and decompress) serialized session state by using the .NET Framework “System.IO.Compression.GZipStream” class and that would reduce the table size.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;&amp;lt;UPDATE&amp;gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;KB &lt;a href="http://support.microsoft.com/kb/973849"&gt;973849&lt;/a&gt;&amp;#160; fix for ASP.NET 2.0 is out :)&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;&amp;lt;/UPDATE&amp;gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Till then bye bye…&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9867230" width="1" height="1"&gt;</description></item><item><title>Using ProcDump.exe to monitor w3wp.exe for CPU spikes</title><link>http://blogs.msdn.com/webtopics/archive/2009/08/08/using-procdump-exe-to-monitor-w3wp-exe-for-cpu-spikes.aspx</link><pubDate>Sat, 08 Aug 2009 02:12:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9860762</guid><dc:creator>jaskis</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9860762.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9860762</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9860762</wfw:comment><description>&lt;p&gt;&lt;a href="http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx"&gt;Procdump&lt;/a&gt; is a light weight Sysinternal's command-line utility whose primary purpose is monitoring an application for CPU spikes and generating crash dumps during such spikes which an administrator or developer can use to determine the cause or to share the dump with PSS for further analysis. It also can serve as a general process dump utility that you can embed in other scripts.&lt;/p&gt;  &lt;p&gt;It completely eliminates the need to maintain different utilities like Debug Daig 1.1 for 32 bit processes and adplus for 64 bit processes on the same server.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;The Problem &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Looking at task manager we can see w3wp.exe process is spiking CPU between 49%-60% intermittently and then immediately it goes down.&lt;/p&gt;  &lt;p&gt;In order to troubleshoot we need to capture 2 sets of dump for w3wp.exe when process reaches 50% CPU and stays there for 3 consecutive seconds or so.This, using Debug Diag 1.1 or Adplus could be a tricky task as it would require great deal of accuracy to manually generate dumps when the actual CPU spike happens or we may end up taking dumps without capturing real activity responsible for the spike.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;The Savior &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx"&gt;ProcDump.exe&lt;/a&gt;&lt;em&gt; &lt;/em&gt;&lt;em&gt;comes&lt;/em&gt; in&lt;b&gt; &lt;/b&gt;handy in such situation to speed up the course of action and help in getting the right set of data. It would monitor the target process for CPU spike within specified time limit and take snapshot at that point. &lt;/p&gt;  &lt;p&gt;For example:&lt;/p&gt;  &lt;p class="error"&gt;&lt;b&gt;procdump -ma -c 50 -s 3 -n 2 5844(Process Name or PID)&lt;/b&gt;     &lt;br /&gt;    &lt;br /&gt;&lt;b&gt;-ma&lt;/b&gt; Write a dump file with all process memory. The default dump format includes thread and handle information.     &lt;br /&gt;    &lt;br /&gt;&lt;b&gt;-c&lt;/b&gt; CPU threshold at which to create a dump of the process.     &lt;br /&gt;    &lt;br /&gt;&lt;b&gt;-s&lt;/b&gt; Consecutive seconds CPU threshold must be hit before dump written (default is 10).     &lt;br /&gt;    &lt;br /&gt;&lt;b&gt;-n&lt;/b&gt; Number of dumps to write before exiting. &lt;/p&gt;  &lt;p&gt;The above command would monitor the w3wp.exe till CPU spikes 50% for 3 seconds and it would take full dump at least for two iterations. &lt;/p&gt;  &lt;p class="error"&gt;C:\Users\jaskis\Downloads\procdump&amp;gt; &lt;b&gt;procdump -ma -c 50 -s 3 -n 2 5844&lt;/b&gt;     &lt;br /&gt;    &lt;br /&gt;ProcDump v1.1 - Writes process dump files     &lt;br /&gt;Copyright (C) 2009 Mark Russinovich     &lt;br /&gt;Sysinternals - &lt;a href="http://www.sysinternals.com"&gt;www.sysinternals.com&lt;/a&gt;     &lt;br /&gt;    &lt;br /&gt;Process:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; w3wp.exe (5844)     &lt;br /&gt;&lt;strong&gt;CPU threshold:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 50% of system&lt;/strong&gt;     &lt;br /&gt;&lt;strong&gt;Duration threshold: 3s&lt;/strong&gt;     &lt;br /&gt;&lt;strong&gt;Number of dumps:&amp;#160;&amp;#160;&amp;#160; 2&lt;/strong&gt;     &lt;br /&gt;Hung window check:&amp;#160; Disabled     &lt;br /&gt;Exception monitor:&amp;#160; Disabled     &lt;br /&gt;Dump file:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; C:\Users\jaskis\Downloads\procdump\w3wp.dmp     &lt;br /&gt;    &lt;br /&gt;Time&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CPU&amp;#160; Duration     &lt;br /&gt;[23:48.35]&amp;#160; 59%&amp;#160; 1s     &lt;br /&gt;[23:48.36] &lt;b&gt;CPU usage below threshold.&lt;/b&gt;     &lt;br /&gt;[23:48.37]&amp;#160; &lt;b&gt;54%&amp;#160; 1s&lt;/b&gt;     &lt;br /&gt;[23:48.38&lt;b&gt;]&amp;#160; 55%&amp;#160; 2s&lt;/b&gt;     &lt;br /&gt;[23:48.39]&amp;#160; &lt;b&gt;61%&amp;#160; 3s&lt;/b&gt;     &lt;br /&gt;&lt;b&gt;Process has hit spike threshold.&lt;/b&gt;     &lt;br /&gt;Writing dump file C:\Users\jaskis\Downloads\procdump\w3wp_080309_114839PM.dmp... Dump written.     &lt;br /&gt;    &lt;br /&gt;[23:48.44]&amp;#160; &lt;strong&gt;61%&amp;#160; 1s&lt;/strong&gt;     &lt;br /&gt;[23:48.45]&amp;#160; &lt;strong&gt;59%&amp;#160; 2s      &lt;br /&gt;&lt;/strong&gt;[23:48.46]&amp;#160; &lt;strong&gt;57%&amp;#160; 3s      &lt;br /&gt;Process has hit spike threshold.       &lt;br /&gt;&lt;/strong&gt;Writing dump file C:\Users\jaskis\Downloads\procdump\w3wp_080309_114846PM.dmp...     &lt;br /&gt;Dump written. &lt;/p&gt;  &lt;p&gt;Few of other interesting switches&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;#160;&amp;#160; -64&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; By default Procdump will capture a 32-bit dump of a 32-bit when running on 64-bit Windows. This option overrides to 64-bit dump.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;#160;&amp;#160; -o&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Overwrite an existing dump file.&lt;/p&gt;  &lt;p&gt;Another area worth investing time would be to write&amp;#160; a batch file and run it as window service to take dump on CPU spike even when the user logoff from the server. &lt;/p&gt;  &lt;p&gt;Stayed tuned for more on this….&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9860762" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/CPU+spike/default.aspx">CPU spike</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/Hgh+cpu/default.aspx">Hgh cpu</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/procdump/default.aspx">procdump</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/capture+dump/default.aspx">capture dump</category></item><item><title>IIS7 (and above) – Using FREB to capture dumps for a long running request</title><link>http://blogs.msdn.com/webtopics/archive/2009/08/04/iis7-and-above-using-freb-to-capture-dumps-for-a-long-running-request.aspx</link><pubDate>Tue, 04 Aug 2009 20:38:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857292</guid><dc:creator>rakkim</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9857292.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9857292</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9857292</wfw:comment><description>&lt;p&gt;In my &lt;a href="http://blogs.msdn.com/webtopics/archive/2009/06/12/troubleshooting-a-simple-error-message-using-freb.aspx"&gt;previous post&lt;/a&gt;, I wrote about using FREB to troubleshoot a simple error message to identify the module which sets the error. For this post, let’s assume we are troubleshooting a slow running page (any page, be it aspx, asmx, html, etc). Not always I would recommend you to collect a dump to understand what’s going on inside. There are a few other ways to troubleshoot a slow running page, say enabling FREB to find out which module is taking long time to process, using RSCA (runtime status control API) data to understand the state of the server, using ETW to understand what’s going on, etc. &lt;/p&gt;  &lt;p&gt;Let’s assume that we are at a point where we need to collect dumps and figure out what’s happening inside the process causing the slowness of the page. &lt;/p&gt;  &lt;p&gt;FREB in IIS7 (and above) comes with an ability to execute an executable when failure definition is satisfied. For example, you can execute an executable when the page takes more than 15 seconds to come up. We can use the AdPlus.vbs shipped with the &lt;a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;Windows Debugging Toolkit&lt;/a&gt; to collect manual hang dumps of the processes. Below are the steps to configure the same:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Enable Failure Request Tracing on the Website &lt;/li&gt;    &lt;li&gt;Go into the “Failed Request Tracing Rules” feature, and click on “Add..” from the Actions pane &lt;/li&gt;    &lt;li&gt;Select the content you want to trace      &lt;ul&gt;       &lt;li&gt;If you want to trace only a specific page, select custom, and give the page name, and click on Next &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Uncheck “Status code(s)”, and select “Time taken (in seconds)”, and enter the number of seconds as 15 seconds      &lt;ul&gt;       &lt;li&gt;Note: This number of seconds is a value decided by you who is troubleshooting, and some pages may take more than 20 seconds to come up based on the logic, or DB activity &lt;/li&gt;     &lt;/ul&gt;      &lt;blockquote&gt;       &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/IIS7andaboveUsingFREBtocapturedumpsforal_1B66/image_5.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/IIS7andaboveUsingFREBtocapturedumpsforal_1B66/image_thumb_1.png" width="481" height="368" /&gt;&lt;/a&gt; &lt;/p&gt;     &lt;/blockquote&gt;   &lt;/li&gt;    &lt;li&gt;Click on Next, and choose Finish to activate the rule &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The UI does not have an option to specify the EXE to be executed when the page takes 15 seconds to come up. You need to configure the settings using appcmd, or Configuration Editor. Before we see the appcmd commands to configure, let’s see what are those settings that need to be configured. &lt;/p&gt;  &lt;p&gt;Take a look at the &lt;a href="http://www.iis.net/ConfigReference/system.webServer/tracing/traceFailedRequests/add"&gt;configuration reference&lt;/a&gt; for the system.webServer/tracing/traceFailedRequests/add. You have the customActionExe, customActionsParams, customActionsTriggerLimit, and the path. So, if you want to execute the AdPlus to collect dumps of all the workerprocesses, below are the values you need to set to:&lt;/p&gt;  &lt;blockquote&gt;   &lt;div class="code"&gt;     &lt;p&gt;&lt;b&gt;customActionExe&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; c&lt;/b&gt;:\windows\system32\cscript.exe&lt;/p&gt;      &lt;p&gt;&lt;b&gt;customActionParams&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; c&lt;/b&gt;:\debuggers\adplus.vbs -hang -pn w3wp.exe -o c:\dumps-quiet&lt;/p&gt;      &lt;p&gt;&lt;b&gt;customActionTriggerLimit&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/b&gt;10&lt;/p&gt;   &lt;/div&gt; &lt;/blockquote&gt;  &lt;p&gt;Most importantly, you need to set the customActionsEnabled at the website level (under system.applicationHost) to true. &lt;/p&gt;  &lt;blockquote&gt;   &lt;div class="code"&gt;     &lt;p&gt;&lt;strong&gt;customActionsEnabled&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; true&lt;/p&gt;   &lt;/div&gt; &lt;/blockquote&gt;  &lt;p&gt;Below are the appcmd to configure them:&lt;/p&gt;  &lt;blockquote&gt;   &lt;div class="code"&gt;     &lt;p&gt;&lt;em&gt;&lt;strong&gt;Set the customActionExe&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;      &lt;p&gt;appcmd.exe set config &amp;quot;Default Web Site&amp;quot; -section:system.webServer/tracing/traceFailedRequests /[path='test.aspx'].customActionExe:&amp;quot;c:\windows\system32\cscript.exe&amp;quot;&amp;#160; &lt;/p&gt;      &lt;p&gt;&lt;em&gt;&lt;strong&gt;Set the customActionParams&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;      &lt;p&gt;appcmd.exe set config &amp;quot;Default Web Site&amp;quot; -section:system.webServer/tracing/traceFailedRequests /[path='test.aspx'].customActionParams:&amp;quot;’&lt;b&gt;c&lt;/b&gt;:\debuggers\adplus.vbs’ -hang -pn w3wp.exe -o c:\dumps -quiet&amp;quot;&lt;/p&gt;      &lt;p&gt;&lt;em&gt;&lt;strong&gt;Set the customActionTriggerLimit&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;      &lt;p&gt;appcmd.exe set config &amp;quot;Default Web Site&amp;quot; -section:system.webServer/tracing/traceFailedRequests /[path='test.aspx'].customActionTriggerLimit:&amp;quot;5&amp;quot; &lt;/p&gt;      &lt;p&gt;&lt;em&gt;&lt;strong&gt;or everything at one go&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;      &lt;p&gt;appcmd.exe set config &amp;quot;Default Web Site&amp;quot; -section:system.webServer/tracing/traceFailedRequests /[path='test.aspx'].customActionExe:&amp;quot;c:\windows\system32\cscript.exe&amp;quot; /[path='test.aspx'].customActionParams:&amp;quot;&lt;b&gt;c&lt;/b&gt;:\debuggers\adplus.vbs’ -hang -pn w3wp.exe -o c:\dumps -quiet&amp;quot; /[path='test.aspx'].customActionTriggerLimit:&amp;quot;5&amp;quot;&amp;#160; &lt;/p&gt;      &lt;p&gt;&lt;em&gt;&lt;strong&gt;and, most importantly setting customActionsEnabled to true on the website level &lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;      &lt;p&gt;appcmd.exe set config&amp;#160; -section:system.applicationHost/sites /[name='Default Web Site'].traceFailedRequestsLogging.customActionsEnabled:&amp;quot;true&amp;quot;&amp;#160; /commit:apphost&lt;/p&gt;   &lt;/div&gt; &lt;/blockquote&gt;  &lt;p&gt;Below is how your web.config would look like:&lt;/p&gt;  &lt;blockquote&gt;   &lt;div class="code"&gt;     &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;        &lt;br /&gt;&amp;lt;configuration&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;system.webServer&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;tracing&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;traceFailedRequests&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add path=&amp;quot;test.aspx&amp;quot; customActionExe=&amp;quot;c:\windows\system32\cscript.exe&amp;quot; customActionParams=&amp;quot;c:\debuggers\adplus.vbs -hang -pn w3wp.exe -o c:\dumps -quiet&amp;quot; customActionTriggerLimit=&amp;quot;5&amp;quot;&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;traceAreas&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add provider=&amp;quot;ASP&amp;quot; verbosity=&amp;quot;Verbose&amp;quot; /&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add provider=&amp;quot;ASPNET&amp;quot; areas=&amp;quot;Infrastructure,Module,Page,AppServices&amp;quot; verbosity=&amp;quot;Verbose&amp;quot; /&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add provider=&amp;quot;ISAPI Extension&amp;quot; verbosity=&amp;quot;Verbose&amp;quot; /&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add provider=&amp;quot;WWW Server&amp;quot; areas=&amp;quot;Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI&amp;quot; verbosity=&amp;quot;Verbose&amp;quot; /&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/traceAreas&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;failureDefinitions timeTaken=&amp;quot;00:00:15&amp;quot; /&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/add&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/traceFailedRequests&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/tracing&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/system.webServer&amp;gt;         &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/p&gt;   &lt;/div&gt; &lt;/blockquote&gt;  &lt;p&gt;Above configuration would collect a dump of all w3wp.exe processes running, and place them in the c:\dumps folder when a request for test.aspx takes more than 15 seconds. &lt;/p&gt;  &lt;p&gt;Hope this helps!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857292" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/FREB/default.aspx">FREB</category></item><item><title>Uploading a file using FileUpload control fails in IE8</title><link>http://blogs.msdn.com/webtopics/archive/2009/07/27/uploading-a-file-using-fileupload-control-fails-in-ie8.aspx</link><pubDate>Mon, 27 Jul 2009 21:36:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9850220</guid><dc:creator>jaskis</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9850220.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9850220</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9850220</wfw:comment><description>&lt;p&gt;I had another interesting customer issue this week, where in uploading a file using the FileUpload control was failing &lt;b&gt;only with IE8&lt;/b&gt;. As you would do with any client-side issue, I started by collecting Fiddler traces for both the working (IE7) and non-working (IE8) scenarios. Following were the observations:     &lt;br /&gt;    &lt;br /&gt;· IE 7     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Content-Disposition: form-data; name=&amp;quot;targetFile&amp;quot;; &lt;strong&gt;filename=&amp;quot;C:\Users\&amp;lt;username&amp;gt;\Desktop\test.txt&lt;/strong&gt;&amp;quot;     &lt;br /&gt;· IE 8     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Content-Disposition: form-data; name=&amp;quot;targetFile&amp;quot;; &lt;strong&gt;filename=&amp;quot;test.txt&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The question that struck me was - Why would a client-side behavior affect my application? So I started reviewing the code on the server. The customer had server-side code to parse the filename and &lt;strong&gt;look for “\” to determine the filename extension&lt;/strong&gt; (although this can easily be determined using the FileName property of the FileUpload control). This server-side code was failing in the case of IE8 because the entire path was not being passed and hence no “\”.&lt;/p&gt;  &lt;p&gt;While researching further on this to determine why IE8 does not send the complete file path to the server, I came across an IE blog &lt;a href="http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx"&gt;here&lt;/a&gt;. It explains that this is one of the security features implemented in IE8. An excerpt from that blog (below) explains this:&lt;/p&gt;  &lt;p class="error"&gt;&lt;i&gt;Additionally, the “Include local directory path when uploading files” URLAction has been set to &amp;quot;Disable&amp;quot; for the Internet Zone. This change prevents leakage of potentially sensitive local file-system information to the Internet. For instance, rather than submitting the full path &lt;strong&gt;C:\users\&amp;lt;username&amp;gt;\documents\secret\image.png&lt;/strong&gt;, Internet Explorer 8 will now submit only the filename &lt;strong&gt;image.png&lt;/strong&gt;.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;Further to this, I gave the following options to the customer:&lt;/p&gt;  &lt;p&gt;1. Change the logic in the server-side code - It should not be dependent on the client-side file path location and should simply use the FileName property of the FileUpload control.&lt;/p&gt;  &lt;p&gt;2. Enable the IE 8 option to include the local directory path for the Internet Zone on the client-side.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/UploadingafileusingFileUploadcontrolfail_167/clip_image002_2.jpg"&gt;&lt;img title="clip_image002" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="351" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/UploadingafileusingFileUploadcontrolfail_167/clip_image002_thumb.jpg" width="394" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;However considering the number of end users a web application could have, it’s always better to control things on the server-side rather than asking client users to change their configuration.&lt;/p&gt;  &lt;p&gt;Till then bye bye…&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9850220" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/FileUpload/default.aspx">FileUpload</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/IE+8/default.aspx">IE 8</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/fails+upload/default.aspx">fails upload</category></item><item><title>In-Proc Session State Management</title><link>http://blogs.msdn.com/webtopics/archive/2009/07/22/in-proc-session-state-management.aspx</link><pubDate>Wed, 22 Jul 2009 05:51:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9844251</guid><dc:creator>Saurabh Singh</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9844251.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9844251</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9844251</wfw:comment><description>&lt;h2&gt;What is ASP.NET Session?&lt;/h2&gt;  &lt;p&gt;A session is defined as the period of time a unique user interacts with a particular web application.&lt;/p&gt;  &lt;p&gt;HTTP is a stateless protocol, in the sense that a Web server is concerned only with the current HTTP request for any given Web page. The server retains no knowledge of previous requests. &lt;/p&gt;  &lt;p&gt;The stateless nature of HTTP requests presents unique challenges when writing Web applications.&lt;/p&gt;  &lt;p&gt;ASP and ASP.NET applications maintain a user’s session using a feature called session state.&lt;/p&gt;  &lt;p&gt;In this series we are going to talk in detail about how to troubleshoot ASP.NET session state related issues.&lt;/p&gt;  &lt;h3&gt;ASP.NET SESSION MANAGEMENT METHODOLOGIES&lt;/h3&gt;  &lt;p&gt;There are three modes available for ASP.NET session state, within the worker process, SQL server or in a dedicated process which can run either on the same machine or on a different machine. We can select where to store the session data and this can be configured using the mode attribute of the &amp;lt;sessionState&amp;gt; element in the web.config file. Below is an example of the &amp;lt;sessionState&amp;gt; element:&lt;/p&gt;  &lt;pre class="code"&gt;&amp;lt;sessionState mode=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;InProc&amp;quot;

&lt;/span&gt;stateConnectionString=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;tcpip=127.0.0.1:42424&amp;quot;

&lt;/span&gt;sqlConnectionString=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;data source=127.0.0.1;Trusted_Connection=yes&amp;quot;

&lt;/span&gt;cookieless=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;false&amp;quot;&lt;/span&gt; timeout=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;20&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;The following table describes the various options and a brief description of each mode 
  &lt;table cellspacing="1" cellpadding="0" border="1"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;
          &lt;p&gt;&lt;b&gt;Attribute&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;&lt;b&gt;Option&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td&gt;
          &lt;p&gt;mode&lt;/p&gt;
        &lt;/td&gt;

        &lt;td&gt;&amp;#160;&lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;Specifies where to store the session state.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td&gt;&amp;#160;&lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;Off&lt;/p&gt;
        &lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;Disables session state management.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td&gt;&amp;#160;&lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;InProc&lt;/p&gt;
        &lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;Session state is stored locally in memory of ASP.NET worker process.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td&gt;&amp;#160;&lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;StateServer&lt;/p&gt;
        &lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;Session state is stored outside of the ASP.NET worker process and is managed by a Windows service. The location of this service is specified by stateConnectionString attribute.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td&gt;&amp;#160;&lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;SQLServer&lt;/p&gt;
        &lt;/td&gt;

        &lt;td&gt;
          &lt;p&gt;Session state is stored outside of the ASP.NET worker process in a SQL Server database. The location of this database is specified using the sqlConnectionString attribute.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;The table lists the optional attributes that can be used along with the mode attribute within the &amp;lt;sessionState&amp;gt; element 
  &lt;table cellpadding="0" border="1"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="bottom" width="16%"&gt;
          &lt;p&gt;Attribute&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="bottom" width="15%"&gt;
          &lt;p&gt;Option&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="bottom" width="66%"&gt;
          &lt;p&gt;Description&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="16%"&gt;
          &lt;p&gt;cookieless&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="15%"&gt;&amp;#160;&lt;/td&gt;

        &lt;td valign="top" width="66%"&gt;
          &lt;p&gt;Specifies whether sessions without cookies should be used to identify client sessions.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="16%"&gt;&amp;#160;&lt;/td&gt;

        &lt;td valign="top" width="15%"&gt;
          &lt;p&gt;true&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="66%"&gt;
          &lt;p&gt;Indicates that sessions without cookies should be used. &lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="16%"&gt;&amp;#160;&lt;/td&gt;

        &lt;td valign="top" width="15%"&gt;
          &lt;p&gt;false&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="66%"&gt;
          &lt;p&gt;Indicates that sessions without cookies should not be used. This is the default setting.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="16%"&gt;
          &lt;p&gt;timeout&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="15%"&gt;&amp;#160;&lt;/td&gt;

        &lt;td valign="top" width="66%"&gt;
          &lt;p&gt;Specifies the number of &lt;b&gt;minutes&lt;/b&gt; a session can be idle before it is abandoned. The default is 20.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="16%"&gt;
          &lt;p&gt;stateConnectionString&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="15%"&gt;&amp;#160;&lt;/td&gt;

        &lt;td valign="top" width="66%"&gt;
          &lt;p&gt;Specifies the server name and port where session state is stored remotely. For example, &amp;quot;tcpip=127.0.0.1:42424&amp;quot;. This attribute is required when mode is StateServer.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="16%"&gt;
          &lt;p&gt;sqlConnectionString&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="15%"&gt;&amp;#160;&lt;/td&gt;

        &lt;td valign="top" width="66%"&gt;
          &lt;p&gt;Specifies the connection string for a SQL Server. For example, &amp;quot;data source=localhost;Integrated Security=SSPI;Initial Catalog=ASPState&amp;quot;. This attribute is required when mode is SQLServer.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="16%"&gt;
          &lt;p&gt;stateNetworkTimeout&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="15%"&gt;&amp;#160;&lt;/td&gt;

        &lt;td valign="top" width="66%"&gt;
          &lt;p&gt;When using StateServer mode to store session state, specifies the number of seconds the TCP/IP network connection between the Web server and the state server can be idle before the session is abandoned. The default is 10.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;h3&gt;InProc Session State&lt;/h3&gt;

&lt;p&gt;InProc state is considerably faster than either the state server or SQL Server session storage techniques. SQL Server and state server attribute their slowness to serialization/deserialization that happens while reading in/storing out the Session data from the SQL/State server.&lt;/p&gt;

&lt;p&gt;. However storing the session state InProc has its own share of limitations. Some of these are &lt;/p&gt;

&lt;p&gt;- With each app domain restart Session state is lost&lt;/p&gt;

&lt;p&gt;- Process restart will result in loss of Session state data &lt;/p&gt;

&lt;p&gt;- If considerable amount of data are stored in Session state, memory consumption for the process may increase to the point of experiencing issues due to high memory. Therefore, the amount of data being stored in Session state and the time frame during which these data need to be stored should be limited as much as possible.&lt;/p&gt;

&lt;p&gt;- In case one wants to implement InProc Session state in a web farm scenario ensure we have sticky sessions enabled for the web farm as it involves storing of the session data among processes hosted on multiple servers. &lt;/p&gt;

&lt;h4&gt;Troubleshooting InProc Session Loss&lt;/h4&gt;

&lt;p&gt;If you have established that you are running into a session loss issue you should determine whether all users face the issue at the same time or the issue happens for a specific user.&lt;/p&gt;

&lt;p&gt;In a scenario where all users face the issue at the same time, an application domain or a worker process recycle might be the cause of the issue. Process recycle can happen due to multiple reasons including an IISRESET or in case recycling options are enabled in the Application pool properties. If the process was recycled due to an IISRESET you will see the following in the System event logs &lt;/p&gt;

&lt;p&gt;“IIS stop command received from user &amp;lt;domain\username&amp;gt;. The logged data is the status code”&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/image_4.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="430" alt="image" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/image_thumb_1.png" width="342" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;However if the process recycle is due to the application pool recycling options, then we may see different events in the system log. One such example is:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image004_2.jpg"&gt;&lt;img title="clip_image004" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="376" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image004_thumb.jpg" width="340" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can configure the Application Pool recycling options by going to the properties of the application pool &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image006_2.jpg"&gt;&lt;img title="clip_image006" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="399" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image006_thumb.jpg" width="339" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also configure IIS to log application pool recycle events that might cause session loss. This can be done by using the LogEventOnRecycle metabase key. By default the key is configured to capture the following events&lt;/p&gt;

&lt;p&gt;1. AppPoolRecycleTime&lt;/p&gt;

&lt;p&gt;2. AppPoolRecycleMemory&lt;/p&gt;

&lt;p&gt;3. AppPoolRecyclePrivateMemory&lt;/p&gt;

&lt;p&gt;But we can configure it to log events for other events as well. Below is the list of the recycling events that can be logged using this key 
  &lt;table cellspacing="0" cellpadding="0" border="1"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;Value (Decimal)&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;Description&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;1&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;AppPoolRecycleTime&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;2&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;AppPoolRecycleRequests&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;4&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;AppPoolRecycleSchedule&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;8&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;AppPoolRecycleMemory&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;16&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;AppPoolRecycleIsapiUnhealthy&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;32&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;AppPoolRecycleOnDemand&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;64&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;AppPoolRecycleConfigChange&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;128&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="125"&gt;
          &lt;p&gt;AppPoolRecyclePrivateMemory&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;In order to enable logging for all recycle events we need to run the following command &lt;/p&gt;

&lt;p&gt;C:\Inetpub\AdminScripts&amp;gt;cscript adsutil.vbs SET W3SVC/AppPools/LogEventOnRecycle 255&lt;/p&gt;

&lt;p&gt;Here is a screenshot of the event that will be logged in the System event log when one of the above events occur.&lt;/p&gt;

&lt;p&gt;For e.g. if we have the value for AppPoolRecycleSchedule set in the IIS metabase you will see something similar as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image008_2.jpg"&gt;&lt;img title="clip_image008" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="434" alt="clip_image008" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image008_thumb.jpg" width="346" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6f43da84-38b0-422b-aa2b-195643d05d22.mspx?mfr=true"&gt;http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6f43da84-38b0-422b-aa2b-195643d05d22.mspx?mfr=true&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In case of a process crash, you may see the following events generated in the system event logs &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image010_2.jpg"&gt;&lt;img title="clip_image010" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="430" alt="clip_image010" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image010_thumb.jpg" width="342" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this case you need to configure a crash rule with either Debug Diagnostic 1.1 (32 bit server) or ADPLUS (works for both 32 bit and a 64 bit server however does not have a GUI).&lt;/p&gt;

&lt;p&gt;To Download Debug Diagnostic 1.1 - &lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1286"&gt;http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1286&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To Download ADPLUS - ADPlus is included with the latest Microsoft Debugging Tools for Windows. To obtain the latest Microsoft Debugging Tools for Windows - &lt;a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;http://www.microsoft.com/whdc/devtools/debugging/default.mspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to use ADPlus to troubleshoot &amp;quot;hangs&amp;quot; and &amp;quot;crashes&amp;quot; - &lt;a href="http://support.microsoft.com/kb/286350/"&gt;http://support.microsoft.com/kb/286350/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is possible that you will not see any entries in the event logs. In that case the problem may be due to an app domain recycle.You can figure out what is causing app domain recycles by implementing one of the methods below :-&lt;/p&gt;

&lt;p&gt;Enable health monitoring by adding the following code in the web.config file under &amp;lt;System.web&amp;gt; element&lt;b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&amp;lt;healthMonitoring&amp;gt;

&amp;lt;rules&amp;gt;

&amp;lt;add name=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;Application Events&amp;quot;

&lt;/span&gt;eventName=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;Application Lifetime Events&amp;quot;

&lt;/span&gt;provider=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;EventLogProvider&amp;quot;

&lt;/span&gt;profile=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;Default&amp;quot;

&lt;/span&gt;minInterval=&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;00:01:00&amp;quot;&lt;/span&gt; /&amp;gt;

&amp;lt;/rules&amp;gt;

&amp;lt;/healthMonitoring&amp;gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Save your web.config file and run your application. View a couple of pages and change the web.config (just add a space and delete the space anywhere in your web.config and save it). Now have a look at your Event Viewer. It should have the following logs -&lt;/p&gt;

&lt;p class="error"&gt;Event Type: Information 
  &lt;br /&gt;Event Source: ASP.NET 2.0.50727.0 

  &lt;br /&gt;Event Category: Web Event 

  &lt;br /&gt;Event ID: 1305 

  &lt;br /&gt;Date: 4/13/2006 

  &lt;br /&gt;Time: 6:19:30 PM 

  &lt;br /&gt;User: N/A 

  &lt;br /&gt;Computer: &amp;lt;computer name&amp;gt; 

  &lt;br /&gt;Description: 

  &lt;br /&gt;Event code: 1001 Event message: Application is starting. Event time: 4/13/2006 6:19:29 PM Event time (UTC): 4/13/2006 12:49:29 PM Event ID: a01d7c9ff12a43a9baed46f7823f11cd Event sequence: 1 Event occurrence: 1 Event detail code: 0 Application information: Application domain&lt;/p&gt;

&lt;p class="error"&gt;Event Type: Information 
  &lt;br /&gt;Event Source: ASP.NET 2.0.50727.0 

  &lt;br /&gt;Event Category: Web Event 

  &lt;br /&gt;Event ID: 1305 

  &lt;br /&gt;Date: 4/13/2006 

  &lt;br /&gt;Time: 6:19:30 PM 

  &lt;br /&gt;User: N/A 

  &lt;br /&gt;Computer: &amp;lt;computer name&amp;gt; 

  &lt;br /&gt;Description: 

  &lt;br /&gt;Event code: 1002 Event message: Application is shutting down. Event time: 4/13/2006 6:19:29 PM Event time (UTC): 4/13/2006 12:49:29 PM Event ID: a01d7c9ff12a43a9baed46f7823f11cd Event sequence: 1 Event occurrence: 1 Event detail code: 0 Application information: Application domain&lt;/p&gt;

&lt;p&gt;Reference – &lt;a href="http://msdn.microsoft.com/en-us/library/2fwh2ss9.aspx"&gt;http://msdn.microsoft.com/en-us/library/2fwh2ss9.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also add the following code snippet to the Application_End event in the global.asax of your application. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Application_End() 
{
     HttpRuntime runtime = (HttpRuntime) &lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(System.Web.HttpRuntime).InvokeMember(&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;_theRuntime&amp;quot;&lt;/span&gt;,  BindingFlags.NonPublic | 
                            BindingFlags.Static |BindingFlags.GetField,  &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;,  &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;,  &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;); 
     &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (runtime == &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;) &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt;;
     &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; shutDownMessage = (&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;) runtime.GetType().InvokeMember(&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;_shutDownMessage&amp;quot;&lt;/span&gt;, BindingFlags.NonPublic  | BindingFlags.Instance | 
                              BindingFlags.GetField,  &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;,  runtime,  &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;); 
     &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; shutDownStack = (&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;) runtime.GetType().InvokeMember(&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;_shutDownStack&amp;quot;&lt;/span&gt;, BindingFlags.NonPublic  | BindingFlags.Instance | BindingFlags.GetField,  &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;,  runtime,  &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;); 

     &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (!EventLog.SourceExists(&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;.NET Runtime&amp;quot;&lt;/span&gt;)) 
                {
                      EventLog.CreateEventSource(&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;.NET Runtime&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;Application&amp;quot;&lt;/span&gt;);
                }

     EventLog log = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; EventLog();
     log.Source = &lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;.NET Runtime&amp;quot;&lt;/span&gt;;
     log.WriteEntry(String.Format(&lt;span style="color: rgb(163,21,21)"&gt;&amp;quot;\r\n\r\n_shutDownMessage={0}\r\n\r\n_shutDownStack={1}&amp;quot;&lt;/span&gt;, shutDownMessage, shutDownStack), 
     EventLogEntryType.Error);
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Reference - &lt;a href="http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If it’s happening for only some users there is a possibility that the Session state is set to &amp;quot;InProc” and Web garden is enabled in IIS. If this is indeed true then you should disable Web Gardening.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image012_2.jpg"&gt;&lt;img title="clip_image012" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="430" alt="clip_image012" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image012_thumb.jpg" width="342" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are running Web farm and using InProc Session, then this could be a possible cause of session loss as all the Session information is stored within the Worker process. Ensure that you have NLB with sticky sessions enabled. In order to verify this we need to take a network trace and ensure that all the requests are reaching the same server they originated from.&lt;/p&gt;

&lt;p&gt;Another common issue seen with Web farm scenarios is when the IIS Metabase is not same for all the Web servers in the farm. The main issue comes with Web site identifier mismatch. ( &lt;a href="http://support.microsoft.com/?id=325056"&gt;http://support.microsoft.com/?id=325056&lt;/a&gt; )&lt;/p&gt;

&lt;p&gt;Another thing to check is whether the &amp;lt;domain name&amp;gt; \ &amp;lt;server name&amp;gt; has special characters such as “_” in it? Check this &lt;a href="http://support.microsoft.com/?id=316112"&gt;http://support.microsoft.com/?id=316112&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There can be scenarios where users get Session loss from a specific machine but not from other machine. This could be due to the browser dropping cookie. The best way to approach this is to try browsing the site with an alternate browser or use tools such as Fiddler or Network Monitor to capture the traffic and see whether we are getting the cookie.&lt;/p&gt;

&lt;p&gt;Some of the known issues with IE are described here&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Session variables are lost if you use FRAMESET in Internet Explorer 6&lt;/b&gt; à &lt;a href="http://support.microsoft.com/kb/323752"&gt;http://support.microsoft.com/kb/323752&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we troubleshoot Session state, we need an application to test it with. Below is the code for a simple ASP.NET page that writes to and reads from session state.&lt;/p&gt;

&lt;pre class="code"&gt;&amp;lt;%@ Page Language=&amp;quot;VB&amp;quot; AutoEventWireup=&amp;quot;false&amp;quot; CodeFile=&amp;quot;Default.aspx.vb&amp;quot; Inherits=&amp;quot;_Default&amp;quot; %&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; &amp;gt;
&amp;lt;head runat=&amp;quot;server&amp;quot;&amp;gt;
&amp;lt;title&amp;gt;Untitled Page&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;
Sub Session_Add(ByVal sender As Object, ByVal e As EventArgs)
Session(&amp;quot;MySession&amp;quot;) = text1.Value
span1.InnerHtml = &amp;quot;Session data updated! &amp;lt;P&amp;gt;&amp;quot; + &amp;quot;Your session contains: &amp;lt;font color=red&amp;gt;&amp;quot; + Session(&amp;quot;MySession&amp;quot;).ToString()
End Sub
Sub CheckSession(ByVal sender As Object, ByVal e As EventArgs)
If (IsNothing(Session(&amp;quot;MySession&amp;quot;))) Then
span1.InnerHtml = &amp;quot;NOTHING, SESSION DATA LOST!&amp;quot;
Else
End If
span1.InnerHtml = &amp;quot;Your session contains: &amp;lt;font color=red&amp;gt;&amp;quot; + Session(&amp;quot;MySession&amp;quot;).ToString() 
End Sub
&amp;lt;/script&amp;gt;
&amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
&amp;lt;input id=&amp;quot;text1&amp;quot; type=&amp;quot;text&amp;quot; runat=&amp;quot;server&amp;quot;/&amp;gt;
&amp;lt;input type=&amp;quot;submit&amp;quot; runat=&amp;quot;server&amp;quot; onserverclick=&amp;quot;Session_Add&amp;quot; value=&amp;quot;Add to Session State&amp;quot;/&amp;gt;
&amp;lt;input type=&amp;quot;submit&amp;quot; runat=&amp;quot;server&amp;quot; onserverclick=&amp;quot;CheckSession&amp;quot; value=&amp;quot;View Session State&amp;quot; /&amp;gt; 
&amp;lt;span id=&amp;quot;span1&amp;quot; runat=&amp;quot;server&amp;quot; /&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/pre&gt;

&lt;p&gt;The above page has two buttons one for adding a Session state value, and the other for retrieving the value. When you browse the application you initially get the following page &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image014_2.jpg"&gt;&lt;img title="clip_image014" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="363" alt="clip_image014" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image014_thumb.jpg" width="644" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The corresponding Fiddler trace gives you the following result &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/image_6.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="434" alt="image" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/image_thumb_2.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;At this moment no cookie has been created and only the Authorization Header is being passed to the server in the request. Now enter a random value in the textbox and click Add to Session state. In my example, I am adding “test” as the session state value. Observe the following &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image018_2.jpg"&gt;&lt;img title="clip_image018" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="429" alt="clip_image018" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image018_thumb.jpg" width="633" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The corresponding Fiddler trace shows the following result &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image020_2.jpg"&gt;&lt;img title="clip_image020" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="427" alt="clip_image020" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image020_thumb.jpg" width="638" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice in the response headers that the server is sending a Session cookie. &lt;/p&gt;

&lt;p&gt;When the Session value is retrieved, I get the following results:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image022_2.jpg"&gt;&lt;img title="clip_image022" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="419" alt="clip_image022" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image022_thumb.jpg" width="627" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The corresponding Fiddler trace gives the following result &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image024_2.jpg"&gt;&lt;img title="clip_image024" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="420" alt="clip_image024" src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/SessionManagement_670E/clip_image024_thumb.jpg" width="629" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;- The client has sent the session cookie. If the cookie is lost in transit or is not sent by the client, the server will be unable to locate the Session which will lead to a Session loss scenario. &lt;/p&gt;

&lt;p&gt;Tools to use&lt;/p&gt;

&lt;p&gt;Download Network Monitor 3.3:- &lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=983b941d-06cb-4658-b7f6-3088333d062f"&gt;http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=983b941d-06cb-4658-b7f6-3088333d062f&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Download Fiddler: - &lt;a href="http://www.fiddlertool.com/fiddler/"&gt;http://www.fiddlertool.com/fiddler/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: - Fiddler doesn’t capture data over localhost. So use machine name or FQDN while trying to access the Web site.&lt;/p&gt;

&lt;p&gt;Some of the other common issues that can contribute to a session loss are &lt;/p&gt;

&lt;p&gt;1. Deleting ASP.NET 2.0 Application Sub-Directories Shuts Down the AppDomain &lt;/p&gt;

&lt;p&gt;Reference - &lt;a href="http://blogs.msdn.com/toddca/archive/2005/12/01/499144.aspx"&gt;http://blogs.msdn.com/toddca/archive/2005/12/01/499144.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2. Unhandled exceptions cause ASP.NET-based applications to unexpectedly quit in the .NET Framework 2.0&lt;/p&gt;

&lt;p&gt;Reference - &lt;a href="http://support.microsoft.com/?id=911816"&gt;http://support.microsoft.com/?id=911816&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3. Overwhelming Change Notifications&lt;/p&gt;

&lt;p&gt;Reference - &lt;a href="http://support.microsoft.com/?id=920970"&gt;http://support.microsoft.com/?id=920970&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4. Application domain recycle due to file change notifications&lt;/p&gt;

&lt;p&gt;Reference - &lt;a href="http://support.microsoft.com/kb/911272/en-us"&gt;http://support.microsoft.com/kb/911272/en-us&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5. In case of other queries regarding Session loss issues refer to - &lt;a href="http://forums.asp.net/p/7504/7504.aspx#7504"&gt;http://forums.asp.net/p/7504/7504.aspx#7504&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;*CREDIT goes to Mohit Hotchandani from PSS IIS/ASP.Net support for this post.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9844251" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Getting the Sys.WebForms.PageRequestManagerParserErrorException while making an AJAX callback</title><link>http://blogs.msdn.com/webtopics/archive/2009/07/21/getting-the-sys-webforms-pagerequestmanagerparsererrorexception-while-making-an-ajax-callback.aspx</link><pubDate>Tue, 21 Jul 2009 22:51:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9843763</guid><dc:creator>amitsh</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9843763.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9843763</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9843763</wfw:comment><description>&lt;p&gt;Recently I encountered an issue wherein our customer was running into a client side AJAX exception, &lt;b&gt;Sys.WebForms.PageRequestManagerParserErrorException&lt;/b&gt;, while trying to make an Async Postback from an ASPX page. This exception was happening for all the clients in a specific network and looked like this:&lt;/p&gt;  &lt;p class="error"&gt;---------------------------    &lt;br /&gt;Microsoft Internet Explorer     &lt;br /&gt;---------------------------     &lt;br /&gt;Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.     &lt;br /&gt;    &lt;br /&gt;Details: Error parsing near&amp;#160; &amp;lt;SOME PLACE&amp;gt;     &lt;br /&gt;---------------------------     &lt;br /&gt;OK&amp;#160; &lt;br /&gt;---------------------------&lt;/p&gt;  &lt;p&gt;This issue generally comes up when the client is making an Async Postback and the response which comes back is not as expected. If anything gets appended to the response other than the expected HTML, or if the client gets a completely different response than what it expected, the client is not able to parse the response correctly and ends up throwing the above exception. The location of the response/request modification could be anywhere between the client and the server, including intermediary network devices. &lt;a href="http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx" target="_blank"&gt;This article&lt;/a&gt; explains it really well.&lt;/p&gt;  &lt;p&gt;Though the exception is pretty self explanatory it can be hard to track down who is modifying the response and/or even the request itself. In such cases one may have to rely on network traffic capturing tools like Netmon and Fiddler to troubleshoot it. So for investigating this issue we captured netmon and fiddler traces from the client and the server for both working and non-working scenarios. Though this clearly looked like a network issue as it was coming only for clients in specific network, we still wanted to know what was getting changed. Here is how the fiddler request and the response looks like for the test page in working scenario -&lt;/p&gt;  &lt;p&gt;Request -&lt;/p&gt;  &lt;p class="error"&gt;POST /AJAXWebSite/Test.aspx HTTP/1.1    &lt;br /&gt;Accept: */*     &lt;br /&gt;Accept-Language: en-us     &lt;br /&gt;Referer: &lt;a href="http://mymachine/AJAXWebSite/Test.aspx"&gt;http://mymachine/AJAXWebSite/Test.aspx&lt;/a&gt;     &lt;br /&gt;&lt;strong&gt;x-microsoftajax: Delta=true&lt;/strong&gt;     &lt;br /&gt;Content-Type: application/x-www-form-urlencoded; charset=utf-8     &lt;br /&gt;Cache-Control: no-cache     &lt;br /&gt;UA-CPU: x86     &lt;br /&gt;Accept-Encoding: gzip, deflate     &lt;br /&gt;User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; MS-RTC LM 8; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.2; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC EA 2)     &lt;br /&gt;Host: mymachine     &lt;br /&gt;Content-Length: 246     &lt;br /&gt;Connection: Keep-Alive     &lt;br /&gt;Pragma: no-cache     &lt;br /&gt;    &lt;br /&gt;ScriptManager1=ScriptManager1%7CTimer1&amp;amp;__EVENTTARGET=Timer1&amp;amp;__EVENTARGUMENT=&amp;amp;__VIEWSTATE=%2FwEPDwUJNjIzMzE1NzA5ZGT3MKmu9xSktVp3SfAtEYDZUmMU3Q%3D%3D&amp;amp;__EVENTVALIDATION=%2FwEWAgLSiq3NAwLs0bLrBj7PuCpvPWwAmr3CkDtU%2B87Qq6o8&amp;amp;TextBox1=&amp;amp;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Expected Response -&lt;/p&gt;  &lt;p class="error"&gt;HTTP/1.1 200 OK    &lt;br /&gt;Cache-Control: private     &lt;br /&gt;Content-Length: 566     &lt;br /&gt;Content-Type: text/plain; charset=utf-8     &lt;br /&gt;Server: Microsoft-IIS/6.0     &lt;br /&gt;MicrosoftOfficeWebServer: 5.0_Pub     &lt;br /&gt;X-Powered-By: ASP.NET     &lt;br /&gt;X-AspNet-Version: 2.0.50727     &lt;br /&gt;Date: Tue, 21 Jul 2009 14:09:27 GMT     &lt;br /&gt;    &lt;br /&gt;113|updatePanel|UpdatePanel1|     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input name=&amp;quot;TextBox1&amp;quot; type=&amp;quot;text&amp;quot; value=&amp;quot;7/21/2009 10:09:27 AM&amp;quot; id=&amp;quot;TextBox1&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; |0|hiddenField|__EVENTTARGET||0|hiddenField|__EVENTARGUMENT||52|hiddenField|__VIEWSTATE|/wEPDwUJNjIzMzE1NzA5ZGT3MKmu9xSktVp3SfAtEYDZUmMU3Q==|48|hiddenField|__EVENTVALIDATION|/wEWAgLSiq3NAwLs0bLrBj7PuCpvPWwAmr3CkDtU+87Qq6o8|6|asyncPostBackControlIDs||Timer1|0|postBackControlIDs|||13|updatePanelIDs||tUpdatePanel1|0|childUpdatePanelIDs|||12|panelsToRefreshIDs||UpdatePanel1|2|asyncPostBackTimeout||90|9|formAction||Test.aspx|&lt;/p&gt;  &lt;p&gt;But when we took similar traces for the failing scenario here is what we saw for the same request -&lt;/p&gt;  &lt;p class="error"&gt;HTTP/1.1 200 OK    &lt;br /&gt;Cache-Control: private     &lt;br /&gt;Content-Length: 2718     &lt;br /&gt;Content-Type: text/html; charset=utf-8     &lt;br /&gt;Server: Microsoft-IIS/6.0     &lt;br /&gt;MicrosoftOfficeWebServer: 5.0_Pub     &lt;br /&gt;X-Powered-By: ASP.NET     &lt;br /&gt;X-AspNet-Version: 2.0.50727     &lt;br /&gt;Date: Tue, 21 Jul 2009 14:16:53 GMT     &lt;br /&gt;    &lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;&lt;a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;"&gt;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&lt;/a&gt;&amp;gt;     &lt;br /&gt;    &lt;br /&gt;&amp;lt;html xmlns=&amp;quot;&lt;a href="http://www.w3.org/1999/xhtml&amp;quot;"&gt;http://www.w3.org/1999/xhtml&amp;quot;&lt;/a&gt;&amp;gt;     &lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;     &lt;br /&gt;    &lt;br /&gt;&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;     &lt;br /&gt;&amp;lt;body&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;post&amp;quot; action=&amp;quot;Test.aspx&amp;quot; id=&amp;quot;form1&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;div&amp;gt;     &lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__EVENTTARGET&amp;quot; id=&amp;quot;__EVENTTARGET&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__EVENTARGUMENT&amp;quot; id=&amp;quot;__EVENTARGUMENT&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__VIEWSTATE&amp;quot; id=&amp;quot;__VIEWSTATE&amp;quot; value=&amp;quot;/wEPDwUJNjIzMzE1NzA5ZGT3MKmu9xSktVp3SfAtEYDZUmMU3Q==&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;/div&amp;gt;     &lt;br /&gt;    &lt;br /&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;     &lt;br /&gt;//&amp;lt;![CDATA[     &lt;br /&gt;var theForm = document.forms['form1'];     &lt;br /&gt;if (!theForm) {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; theForm = document.form1;     &lt;br /&gt;}     &lt;br /&gt;function __doPostBack(eventTarget, eventArgument) {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; if (!theForm.onsubmit || (theForm.onsubmit() != false)) {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; theForm.__EVENTTARGET.value = eventTarget;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; theForm.__EVENTARGUMENT.value = eventArgument;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; theForm.submit();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;}     &lt;br /&gt;//]]&amp;gt;     &lt;br /&gt;&amp;lt;/script&amp;gt;     &lt;br /&gt;    &lt;br /&gt;&amp;lt;script src=&amp;quot;/aspnet_client/system_web/2_0_50727/WebForms.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;     &lt;br /&gt;    &lt;br /&gt;&amp;lt;script src=&amp;quot;/AJAXWebSite/ScriptResource.axd?d=ktG6RH-5YekKOFKmPczdQtpmuIwrQ0_IN1WVRbcxrxJarwiTwmePaK1rX5K7SKYF6RcFAExALSoSedjYxsT-46bYYF7ifZVAG_-JOynQe0A1&amp;amp;amp;t=ffffffffa46422ae&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;     &lt;br /&gt;&amp;lt;script src=&amp;quot;/AJAXWebSite/ScriptResource.axd?d=ktG6RH-5YekKOFKmPczdQtpmuIwrQ0_IN1WVRbcxrxJarwiTwmePaK1rX5K7SKYFksyhgYfs5XBNWIel6UBRrkKMZWUoedc8dmuiqHrMtPg1&amp;amp;amp;t=ffffffffa46422ae&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;     &lt;br /&gt;&amp;lt;script src=&amp;quot;/AJAXWebSite/ScriptResource.axd?d=ktG6RH-5YekKOFKmPczdQtpmuIwrQ0_IN1WVRbcxrxJarwiTwmePaK1rX5K7SKYFQnR-aK0Xy6ZPnKAS2x4xTc249FkSXpb_JOTlKStYU3c1&amp;amp;amp;t=ffffffffa46422ae&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;     &lt;br /&gt;&amp;lt;div&amp;gt;     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__EVENTVALIDATION&amp;quot; id=&amp;quot;__EVENTVALIDATION&amp;quot; value=&amp;quot;/wEWAgLSiq3NAwLs0bLrBj7PuCpvPWwAmr3CkDtU+87Qq6o8&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;/div&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;div&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;     &lt;br /&gt;//&amp;lt;![CDATA[     &lt;br /&gt;Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));     &lt;br /&gt;Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], ['Timer1'], [], 90);     &lt;br /&gt;//]]&amp;gt;     &lt;br /&gt;&amp;lt;/script&amp;gt;     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;span id=&amp;quot;Timer1&amp;quot; style=&amp;quot;visibility:hidden;display:none;&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;div id=&amp;quot;UpdatePanel1&amp;quot;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input name=&amp;quot;TextBox1&amp;quot; type=&amp;quot;text&amp;quot; value=&amp;quot;7/21/2009 10:16:53 AM&amp;quot; id=&amp;quot;TextBox1&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;lt;/div&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/div&amp;gt;     &lt;br /&gt;    &lt;br /&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;     &lt;br /&gt;//&amp;lt;![CDATA[     &lt;br /&gt;Sys.Application.initialize();     &lt;br /&gt;Sys.Application.add_init(function() {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $create(Sys.UI._Timer, {&amp;quot;enabled&amp;quot;:true,&amp;quot;interval&amp;quot;:10000,&amp;quot;uniqueID&amp;quot;:&amp;quot;Timer1&amp;quot;}, null, null, $get(&amp;quot;Timer1&amp;quot;));     &lt;br /&gt;});     &lt;br /&gt;//]]&amp;gt;     &lt;br /&gt;&amp;lt;/script&amp;gt;     &lt;br /&gt;&amp;lt;/form&amp;gt;     &lt;br /&gt;&amp;lt;/body&amp;gt;     &lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;  &lt;p&gt;Instead of getting a response for the Async Postback we were getting a response for the entire page. So it was not possible for the client to parse through it and attach the content to the controls in the UpdatePanel1 and hence it was throwing the&amp;#160; Sys.WebForms.PageRequestManagerParserErrorException exception for the HTML tags etc. Now this led us to understand that the server was not treating the request as an Asynch Postback; rather it was treating it as a full postback and sending the entire HTML response back to the client.&lt;/p&gt;  &lt;p&gt;In ASP.NET 3.5 and earlier we recognize the AJAX callback by the HTTP header “&lt;i&gt;x-microsoftajax: Delta=true&lt;/i&gt;”. When we took a netmon trace between the client and the server we found the client was sending the above header as part of the HTTP request headers but it was never reaching the server. We then found that the customer had a non-Microsoft firewall which was removing all unrecognized HTTP headers including &lt;i&gt;x-microsoftajax&lt;/i&gt;. This resulted in the server treating the request as a normal postback and the server responded back with the complete HTML instead of the partial response, causing the above exception on the client side.&lt;/p&gt;  &lt;p&gt;There are few firewalls which are capable of removing the HTTP Headers. There are some which do not recognize the &lt;i&gt;x-microsoftajax&lt;/i&gt; header as well. We can use one of the options below to fix the issue:&lt;/p&gt;  &lt;p&gt;1. Turn off the option in the Firewall settings which disallows unrecognized HTTP Headers – the HTTP protocol gives the capability to write custom header(s) to developers. By disallowing unrecognized HTTP Headers the firewall is limiting this capability of the HTTP protocol.&lt;/p&gt;  &lt;p&gt;2. Upgrade to Service Pack 1 of .NET Framework 3.5 – As there are few firewalls which disallow the &lt;i&gt;x-microsoftajax&lt;/i&gt; header, we did a fix for UpdatePanel to send a form value in addition to the header to work around the broken proxies/firewalls issue in 3.5 SP1. Now AJAX callback requests send a form field “__ASYNCPOST=true” along with the request and&amp;#160; &lt;i&gt;x-microsoftajax&lt;/i&gt; header. On the server side we check both the Form Field and the header to verify the AJAX request.&lt;/p&gt;  &lt;p&gt;I hope this helps!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9843763" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/AJAX/default.aspx">AJAX</category></item><item><title>“Parser Error Message: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.” when .net page has debug=”true”</title><link>http://blogs.msdn.com/webtopics/archive/2009/07/20/parser-error-message-this-implementation-is-not-part-of-the-windows-platform-fips-validated-cryptographic-algorithms-when-net-page-has-debug-true.aspx</link><pubDate>Mon, 20 Jul 2009 19:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9841878</guid><dc:creator>vivekkum</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9841878.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9841878</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9841878</wfw:comment><description>&lt;P&gt;Recently, I came across an issue where the customer faced an FIPS (Federal Information Processing Standards) related error on the .aspx pages which had debug=”true”. His ASP.net application was hosted on IIS7 running on Windows Server 2008 SP2.&amp;nbsp; And, he was able to reproduce the issue using a very simple page. The error message was:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ParserErrorMessageT.aspxpagehasdebugtrue_850B/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ParserErrorMessageT.aspxpagehasdebugtrue_850B/image_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ParserErrorMessageT.aspxpagehasdebugtrue_850B/image_thumb.png" width=790 height=363 mce_src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ParserErrorMessageT.aspxpagehasdebugtrue_850B/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Looking at the error, we know that there are articles like &lt;A href="http://support.microsoft.com/kb/911722" mce_href="http://support.microsoft.com/kb/911722"&gt;KB 911722&lt;/A&gt; and a good blog - &lt;A href="http://blogs.msdn.com/shawnfa/archive/2005/05/16/417975.aspx" mce_href="http://blogs.msdn.com/shawnfa/archive/2005/05/16/417975.aspx"&gt;Enforcing FIPS Certified Cryptography&lt;/A&gt; which discuss the same issue. &lt;/P&gt;
&lt;P&gt;In Windows Server 2008, the FIPS related registry key is:&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Consolas&gt;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy] "Enabled"=dword:00000000&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;With the setting &lt;FONT color=#ff0000 size=2 face=Consolas&gt;"Enabled"=dword:00000000&lt;/FONT&gt; we know the FIPS enforcement is disabled.&lt;/P&gt;
&lt;P&gt;While troubleshooting, we checked the Local Security Policy setting on the server, at Administrative Tools -&amp;gt; Local Security Policy -&amp;gt; Local Policies -&amp;gt; Security Options -&amp;gt; “System cryptography: Use FIPS compliant algorithms for encryption, hashing and signing” and it showed that it was disabled.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;The customer said that sometime back his domain administrators enabled FIPS on their Windows Server 2003 DC and that they enforced it domain-wide using Group Policy. They had then disabled the setting due to the application starting to fail with the Parser Error.&lt;/P&gt;
&lt;P&gt;The customer did have a workaround, they can follow the article &lt;A href="http://blogs.msdn.com/shawnfa/archive/2008/03/14/disabling-the-fips-algorithm-check.aspx" mce_href="http://blogs.msdn.com/shawnfa/archive/2008/03/14/disabling-the-fips-algorithm-check.aspx"&gt;Disabling the FIPS Algorithm Check&lt;/A&gt; i.e. adding &lt;FONT size=2 face=Consolas&gt;&amp;lt;enforceFIPSPolicy enabled="false"/&amp;gt;&lt;/FONT&gt; in their web.config file, however the customer was keen to know the cause of the issue..&lt;/P&gt;
&lt;P&gt;So, we know on Windows Server 2003, the registry key for FIPS is&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Consolas&gt;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa] "fipsalgorithmpolicy"=dword:00000001&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;With this in mind, we checked the registry hive on the customer’s WIN2K8 server and there was this WIN2K3 dword value set ("&lt;FONT size=2 face=Consolas&gt;fipsalgorithmpolicy"=dword:00000001&lt;/FONT&gt;). This was in fact causing the issue. It looked like the Win2k3 domain Group Policy added the registry key on the Windows Server 2008 but did not change the value of the key back when the Group Policy was changed. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ParserErrorMessageT.aspxpagehasdebugtrue_850B/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ParserErrorMessageT.aspxpagehasdebugtrue_850B/image_4.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ParserErrorMessageT.aspxpagehasdebugtrue_850B/image_thumb_1.png" width=743 height=329 mce_src="http://blogs.msdn.com/blogfiles/webtopics/WindowsLiveWriter/ParserErrorMessageT.aspxpagehasdebugtrue_850B/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;I tried to reproduce the issue on my own server by forcing FIPS using Windows Server 2003 DC on my Windows Server 2008 IIS server, and the registry key does gets modified when I enable FIPS from GPO. After disabling FIPS from GPO&amp;nbsp;I did “&lt;FONT size=2 face=Consolas&gt;gpupdate /force&lt;/FONT&gt;” from the command prompt on my Windows Server 2008 server and the registry value is changed from 1 to 0.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Resolution:&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;To resolve the customer’s problem, we removed "&lt;FONT size=2 face=Consolas&gt;fipsalgorithmpolicy"=dword:00000001&lt;/FONT&gt; from &lt;FONT size=2 face=Consolas&gt;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa].&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Doing a bit more research into the mechanics of the issue, here is what I believe happens: first .NET checks to see if the applicable config file (web.config) has the FIPS enforcement disabled. If the config file doesn't have it disabled then it calls BCryptGetFipsAlgorithmMode (public API) to see what is set in the registry. Inside BCryptGetFipsAlgorithmMode it first reads "HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy\Enabled". If that is not set it then reads "HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy"&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9841878" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/FIPS/default.aspx">FIPS</category></item><item><title>Troubleshooting HTTP 401.3 errors with Process Monitor</title><link>http://blogs.msdn.com/webtopics/archive/2009/06/25/troubleshooting-http-401-3-errors-with-process-monitor.aspx</link><pubDate>Fri, 26 Jun 2009 04:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9804401</guid><dc:creator>KyleT</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9804401.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9804401</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9804401</wfw:comment><description>&lt;P&gt;Last week I posted the following blog which showed how to use Process Monitor to troubleshoot service startup issues.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/webtopics/archive/2009/06/16/troubleshooting-service-startup-issues-with-process-monitor.aspx" mce_href="http://blogs.msdn.com/webtopics/archive/2009/06/16/troubleshooting-service-startup-issues-with-process-monitor.aspx"&gt;http://blogs.msdn.com/webtopics/archive/2009/06/16/troubleshooting-service-startup-issues-with-process-monitor.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;To continue on that topic, I ran across another issue recently where Process Monitor was again very helpful in troubleshooting.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Problem&lt;/STRONG&gt; – When browsing ASP pages, we were getting below error in the browser. Browsing any HTML page worked fine.&lt;/P&gt;
&lt;P class=error&gt;&lt;STRONG&gt;HTTP Error 401.3 - Unauthorized: Access is denied due to an ACL set on the requested resource.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Note that you may need to &lt;U&gt;uncheck&lt;/U&gt; &lt;STRONG&gt;Show friendly HTTP error messages&lt;/STRONG&gt; in Internet Explorer on the &lt;STRONG&gt;Advanced&lt;/STRONG&gt; tab under &lt;STRONG&gt;Tools/Internet Options&lt;/STRONG&gt; as shown below to see this exact error.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG src="http://blogs.msdn.com/photos/kylet/images/9804395/original.aspx" mce_src="http://blogs.msdn.com/photos/kylet/images/9804395/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;It is good practice to leave this option unchecked when you’re troubleshooting an issue that involves an error message in the browser, since you’ll be more likely to get a full detailed error message. You could also check the IIS logs and look at the sc-status and sc-substatus fields to see 401 and 3 respectively.&lt;/P&gt;
&lt;P&gt;Now I captured a Process Monitor log while reproducing the issue. As usual, I started by filtering on Result is Access Denied in Process Monitor after reproducing the issue. I found that there were no related Access Denied entries. You would expect that Process Monitor would capture an Access Denied result with an ACL (Access Control List) error like HTTP 401.3.&lt;/P&gt;
&lt;P&gt;I found that this can occur when the account the IIS worker process was launched as has access to a particular file, but the user that authenticated through website does not. To see this in Process Monitor, I first filtered on w3wp.exe for the process name, which is the worker process that hosts a web site in IIS 6.0.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG src="http://blogs.msdn.com/photos/kylet/images/9804393/original.aspx" mce_src="http://blogs.msdn.com/photos/kylet/images/9804393/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;I then looked through the Process Monitor output for the access to C:\WINDOWS\Help\iisHelp\common\401-3.htm, which is the file IIS reads in by default to display the 401.3 error in the browser. Once I found that, I looked for what showed up in the log just before then.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG src="http://blogs.msdn.com/photos/kylet/images/9804392/original.aspx" mce_src="http://blogs.msdn.com/photos/kylet/images/9804392/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;The last thing that was accessed before the 401-3.htm file was asp.dll. Checking the permissions on that file and comparing it to a default installation, I found the permissions were the same.&lt;/P&gt;
&lt;P&gt;See the entry highlighted above that shows a successful access to asp.dll for a QuerySecurityFile operation. The Detail column shows the information queried was the Owner, Group, and DACL (Discretionary Access Control List). Basically what’s going on here is the w3wp.exe process accesses asp.dll using the process identity (NETWORK SERVICE by default). We don’t see an Access Denied result because the process identity has the appropriate permissions. Now it checks to make sure that whatever user browsed the site also has access to asp.dll. In this case, Anonymous Authentication was enabled so the IUSR_MachineName account was checked, which did not have the appropriate permissions.&lt;/P&gt;
&lt;P&gt;The issue here turned out to be that the &lt;STRONG&gt;NT AUTHORITY\Authenticated Users&lt;/STRONG&gt; group was removed from the local &lt;STRONG&gt;Users&lt;/STRONG&gt; group. Adding it back and then restarting IIS resolved the issue. The point here is that using Process Monitor I was able to narrow the issue down to the user accessing the site not having permissions on a specific DLL. In this case, IUSR_MachineName was an Authenticated Users, which should be a member of the Users group, and Users have permissions on asp.dll.&lt;/P&gt;
&lt;H2&gt;Summary&lt;/H2&gt;
&lt;OL&gt;
&lt;LI&gt;Capture Process Monitor log while reproducing issue &lt;/LI&gt;
&lt;LI&gt;Filter on Access Denied &lt;/LI&gt;
&lt;LI&gt;No Access Denied, so filter on w3wp.exe &lt;/LI&gt;
&lt;LI&gt;Look for access to 401-3.htm &lt;/LI&gt;
&lt;LI&gt;Review entries before the 401-3.htm to determine what file was accessed last &lt;/LI&gt;
&lt;LI&gt;Check permissions based on successful QuerySecurityFile operation for last file accessed (in this case was asp.dll) &lt;/LI&gt;&lt;/OL&gt;
&lt;H2&gt;References&lt;/H2&gt;
&lt;P&gt;Below are a couple of articles we use frequently for HTTP 401.3 and other permissions related issues with IIS.&lt;/P&gt;
&lt;P&gt;Default permissions and user rights for IIS 6.0 &lt;BR&gt;&lt;A href="http://support.microsoft.com/kb/812614" mce_href="http://support.microsoft.com/kb/812614"&gt;http://support.microsoft.com/kb/812614&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Troubleshooting HTTP 401 errors in IIS &lt;BR&gt;&lt;A href="http://support.microsoft.com/kb/907273" mce_href="http://support.microsoft.com/kb/907273"&gt;http://support.microsoft.com/kb/907273&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9804401" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/Authentication/default.aspx">Authentication</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/Tools/default.aspx">Tools</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/security/default.aspx">security</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/HTTP/default.aspx">HTTP</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/Access+Denied/default.aspx">Access Denied</category></item><item><title>How to Add a Locked Header Row to an ASP.NET GridView Control</title><link>http://blogs.msdn.com/webtopics/archive/2009/06/23/how-to-add-a-locked-header-row-to-an-asp-net-gridview-control.aspx</link><pubDate>Wed, 24 Jun 2009 03:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9798229</guid><dc:creator>jamesche</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/webtopics/comments/9798229.aspx</comments><wfw:commentRss>http://blogs.msdn.com/webtopics/commentrss.aspx?PostID=9798229</wfw:commentRss><wfw:comment>http://blogs.msdn.com/webtopics/rsscomments.aspx?PostID=9798229</wfw:comment><description>&lt;P&gt;The GridView control is often used to display tabular data, much like an Excel spreadsheet. However, unlike Excel, the GridView control doesn't have any automatic way of locking the header row so that it doesn't scroll out of view. &lt;/P&gt;
&lt;P&gt;Check out &lt;A href="http://www.jimcobooks.com/lockedgrid/unlocked.aspx" target=_blank mce_href="http://www.jimcobooks.com/lockedgrid/unlocked.aspx"&gt;this example&lt;/A&gt; of a GridView within a DIV with the overflow-Y property set to &lt;EM&gt;scroll&lt;/EM&gt;. Notice that as you scroll the GridView, the header row scrolls out of view. It would be more convenient to have a locked header row so that the header row is always visible regardless of the scoll position of the GridView. It would also be nice to have a header row that dynamically configured itself as per the data source so that if we add a new field to the GridView, a corresponding column automatically gets added to the locked header row. &lt;/P&gt;
&lt;P&gt;Here's &lt;A href="http://www.jimcobooks.com/lockedgrid/locked.aspx" target=_blank mce_href="http://www.jimcobooks.com/lockedgrid/locked.aspx"&gt;another example&lt;/A&gt;, but this time, the header row stays locked at the top of the GridView so that you can scroll without losing track of column names. There are a few steps required to implement this functionality.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a DIV on the page to contain the header row and set the DIV (either statically or dynamically) to the same width as the DIV that contains the GridView.&lt;/LI&gt;
&lt;LI&gt;Insert an ASP.NET Table control into the header DIV.&lt;/LI&gt;
&lt;LI&gt;In Page_Init, dynamically add the necessary cells to the header table and set the appropriate properties so that it matches the appearance of the rest of the GridView.&lt;/LI&gt;
&lt;LI&gt;Check for sortable columns and dynamically add sorting LinkButtons to the header row.&lt;/LI&gt;
&lt;LI&gt;Add code to handle the LinkButton's Click event and sort appropriately.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Let's go through each of these steps. (If you'd prefer to work with a working project, you can download the project at the end of this post.)&lt;/P&gt;
&lt;H1&gt;Creating the Header DIV and Inserting an ASP.NET Table Control (Steps 1 and 2)&lt;/H1&gt;
&lt;P&gt;To create a locked header row, we need to disable the header for the GridView control and instead dynamically create our own header. &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Select the GridView control and change the &lt;STRONG&gt;ShowHeader&lt;/STRONG&gt; property to &lt;EM&gt;false&lt;/EM&gt;.&lt;/LI&gt;
&lt;LI&gt;Create a new DIV above the DIV containing the GridView control using the following code.&lt;/LI&gt;&lt;/OL&gt;
&lt;P class=code&gt;&amp;lt;!-- *** Begin Header Table *** --&amp;gt;&lt;BR&gt;&amp;lt;div id="DivHeader" style="vertical-align:top;width:650px;"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;asp:Table ID="HeaderTable" runat="server" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CellPadding="4" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CellSpacing="0" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Font-Size="11pt" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BackColor="#274511" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForeColor="White"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/asp:Table&amp;gt;&lt;BR&gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;lt;!-- *** End Header Table *** --&amp;gt;&lt;/P&gt;
&lt;P&gt;Note that the properties for my Table control were derived from the theme applied to my sample page. You can set these properties as you wish or dynamically set them so that they adjust to the GridView's properties automatically.&lt;/P&gt;
&lt;P&gt;Notice that this Table control doesn't contain any cells. We'll add the necessary cells in Page_Init in the next step.&lt;/P&gt;
&lt;H1&gt;Add Code to Page_Init to Dynamically Create Header Cells and LinkButtons (Steps 3 and 4)&lt;/H1&gt;
&lt;P&gt;To dynamically add the cells for the header table, add the following code to Page_Init.&lt;/P&gt;
&lt;P class=code&gt;protected void Page_Init(object sender, EventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TableRow headerRow = new TableRow();&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int x = 0; x &amp;lt; GridView1.Columns.Count; x++)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataControlField col = GridView1.Columns[x];&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TableCell headerCell = new TableCell();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; headerCell.BorderStyle = BorderStyle.Solid;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; headerCell.BorderWidth = 1;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; headerCell.Font.Bold = true;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // if the column has a SortExpression, we want to allow&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // sorting by that column. Therefore, we create a linkbutton&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // on those columns.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (col.SortExpression != "")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LinkButton lnkHeader = new LinkButton();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lnkHeader.PostBackUrl = HttpContext.Current.Request.Url.LocalPath;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lnkHeader.CommandArgument = col.SortExpression;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lnkHeader.ForeColor = System.Drawing.Color.White;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lnkHeader.Text = col.HeaderText;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lnkHeader.Click += new EventHandler(HeaderLink_Click);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; headerCell.Controls.Add(lnkHeader);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; headerCell.Text = col.HeaderText;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; headerCell.Width = col.ItemStyle.Width;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; headerRow.Cells.Add(headerCell);&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HeaderTable.Rows.Add(headerRow);&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;This code adds a new TableCell to the header table and then sets specific properties on that TableCell based on whether or not the GridView's column has a SortExpression specified. If it doesn't, this code just sets the Text property of the cell to the GridView column's HeaderText property. Otherwise, it creates a LinkButton and sets the following properties on it.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;PostBackUrl&lt;/STRONG&gt; - Set to the local URL of the current request.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;CommandArgument&lt;/STRONG&gt; - Set to the SortExpression of the GridView's column so that we can apply it when the LinkButton is clicked.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;ForeColor&lt;/STRONG&gt; - Set to White in my example, but you can set this dynamically if you wish to make the example more generic.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Text&lt;/STRONG&gt; - Set to the GridView column's HeaderText property.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I also add a new event handler for the Click event of the LinkButton control. Let's look at the code for that event.&lt;/P&gt;
&lt;H1&gt;Code for the LinkButton's Click Event&lt;/H1&gt;
&lt;P&gt;The code in the LinkButton's Click event applies the necessary SortExpression based on which LinkButton was clicked. The code for the Click event appears below.&lt;/P&gt;
&lt;P class=code&gt;protected void HeaderLink_Click(object sender, System.EventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LinkButton lnkHeader = (LinkButton)sender;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SortDirection direction = SortDirection.Ascending;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // the CommandArgument of each linkbutton contains the sortexpression&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // for the column that was clicked.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (GridView1.SortExpression == lnkHeader.CommandArgument)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (GridView1.SortDirection == SortDirection.Ascending)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; direction = SortDirection.Descending;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.Sort(lnkHeader.CommandArgument, direction); &lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;This code checks the CommandArgument for the LinkButton that was clicked (retrieved from the EventArgs) and applies the ascending or descending SortDirection based upon the result. It then calls the Sort method on the GridView.&lt;/P&gt;
&lt;H1&gt;AJAX-Enabling the Sample&lt;/H1&gt;
&lt;P&gt;If you are using ASP.NET AJAX, the code as-is will not do a partial postback. In order to have the LinkButtons sort using an AJAX async postback, you need to replace the line of code that sets the &lt;STRONG&gt;PostBackUrl&lt;/STRONG&gt; property of the LinkButton with the following code.&lt;/P&gt;
&lt;P class=code&gt;lnkHeader.ID = "Sort" + col.HeaderText;&lt;/P&gt;
&lt;P&gt;Doing this will allow ASP.NET Viewstate to track the LinkButton so that ASP.NET AJAX will work with the LinkButton.&lt;/P&gt;
&lt;P&gt;Using this example, you can easily apply a locked header row to your GridView controls. If you'd like the completed sample project, you can download it below.&lt;/P&gt;
&lt;H2&gt;Sample Project&lt;/H2&gt;
&lt;P&gt;Size: 12KB&lt;BR&gt;&lt;A href="http://www.jimcobooks.com/lockedgrid/LockedGrid.zip" mce_href="http://www.jimcobooks.com/lockedgrid/LockedGrid.zip"&gt;Download Now&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Note: This download is hosted on my personal site, JimcoBooks.com.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9798229" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/webtopics/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/webtopics/archive/tags/Code/default.aspx">Code</category></item></channel></rss>