<?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>Jerry Orman : ASP.Net</title><link>http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx</link><description>Tags: ASP.Net</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Referencing .js files for the AJAX Control Toolkit</title><link>http://blogs.msdn.com/jorman/archive/2007/05/18/referencing-js-files-for-the-ajax-control-toolkit.aspx</link><pubDate>Sat, 19 May 2007 00:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2718290</guid><dc:creator>Jorman</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jorman/comments/2718290.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=2718290</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=2718290</wfw:comment><description>&lt;P&gt;I was recently working with someone that was leveraging the AJAX Extension and the Control Toolkit and they were running into an issue where a customer's environment was causing issues making requests to ScriptResource.axd.&amp;nbsp; Since they couldn't change the environment, they needed to reference the .js files directly.&amp;nbsp; Here's a rundown of the steps in case anyone needs to do this in the future:&lt;/P&gt;
&lt;P&gt;1. Create a folder to hold the .js files in your site.&amp;nbsp; In my case I created a "Scripts" folder on the root of my app.&lt;/P&gt;
&lt;P&gt;2. Create the following folder structure under the folder from Step 1.&amp;nbsp; The folder that is a version number should match the version of the control toolkit.&amp;nbsp; This can be found on the &lt;A class="" title="AJAX Control Toolkit Releases Page" href="http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=1425" mce_href="  http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=1425"&gt;Releases page&lt;/A&gt; for the extension.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &amp;lt;Root&amp;gt;&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;&amp;nbsp; - Scripts&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - AjaxControlToolkit&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; - 1.0.10301.0&lt;/P&gt;
&lt;P&gt;3. Open the Control Toolkit project and build the solution.&amp;nbsp; This should generate the \obj folder that contains all the .js files.&lt;/P&gt;
&lt;P&gt;4. Copy the Script files for the toolkit project to the site&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From:&amp;nbsp; &amp;lt;path_to_unzipped_toolkit&amp;gt;\AjaxControlToolkit\obj\Debug&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; To:&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.0.10301.0 folder from above&lt;/P&gt;
&lt;P&gt;5. Copy the Script files for the AJAX Extension:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From:&amp;nbsp; Copy the System.Web.Extensions folder and all it's contents from C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\MicrosoftAjaxLibrary&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; To:&amp;nbsp;&amp;nbsp;&amp;nbsp; ~/Script folder.&amp;nbsp; You should have a folder structure similar to:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &amp;lt;Root&amp;gt;&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;&amp;nbsp; - Scripts&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;System.Web.Extensions&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; - 1.0.61025.0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;6. Set the ScriptPath on the &amp;lt;scriptManager&amp;gt; to "~/Scripts"&lt;/P&gt;
&lt;P&gt;7. Make sure the controls are not explicitly setting ScriptPath as that will override the ScriptManager property.&lt;/P&gt;
&lt;P&gt;Now when you browse the page, the .js files will be loaded from the ~/Scripts folder instead of via calls to ScriptResource.axd.&amp;nbsp; If you're getting script errors, take a netmon and ensure all the requests to the .js files are returning a status code of 200 or 304.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2718290" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Fix: Random FileNotFoundException in ASP.Net 2.0 application</title><link>http://blogs.msdn.com/jorman/archive/2007/03/26/fix-random-filenotfoundexception-in-asp-net-2-0-application.aspx</link><pubDate>Mon, 26 Mar 2007 18:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1952824</guid><dc:creator>Jorman</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/jorman/comments/1952824.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=1952824</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=1952824</wfw:comment><description>&lt;P&gt;&lt;STRONG&gt;Issue&amp;nbsp;&lt;/STRONG&gt; -&amp;nbsp; Random FileNotFoundException when browsing ASP.Net 2.0 application.&amp;nbsp; An event similar to the following will be logged in the event viewer.&amp;nbsp; The file name in the exception is typically different every time:&lt;/P&gt;
&lt;P&gt;Exception message: Could not load file or assembly 'App_Web_-a8debde, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. &lt;BR&gt;&lt;BR&gt;&amp;nbsp; Stack trace:&amp;nbsp;&amp;nbsp;&amp;nbsp; at ASP.UserControl_ascx.__BuildControlmain()&lt;BR&gt;&amp;nbsp;&amp;nbsp; at ASP.UserControl_ascx.__BuildControlTree(dynamic_default_ascx __ctrl)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at ASP.UserControl_ascx.FrameworkInitialize()&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Web.UI.UserControl.InitializeAsUserControlInternal()&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Web.UI.UserControl.InitializeAsUserControl(Page page)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at ASP.default_aspx.__BuildControlhtml_content()&lt;BR&gt;&amp;nbsp;&amp;nbsp; at ASP.default_aspx.__BuildControlTree(default_aspx __ctrl)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at ASP.default_aspx.FrameworkInitialize()&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Web.UI.Page.ProcessRequest()&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Web.UI.Page.ProcessRequest(HttpContext context)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at ASP.default_aspx.ProcessRequest(HttpContext context)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;amp; completedSynchronously)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Workarounds&lt;/STRONG&gt;&amp;nbsp; -&amp;nbsp; In some cases, it's necessary to clear the Temporary ASP.Net Files folder and restart the application pool.&amp;nbsp; We've found in some cases that setting batch="false" in the web.config file will resolve the issue as well, however, there are some perf reasons for not doing that long term&amp;nbsp;in production.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Getting the Fix&amp;nbsp; &lt;/STRONG&gt;-&amp;nbsp; The KB for this fix is not yet public (I'll link it as soon as it is), however, the fix is available.&amp;nbsp; You will need to contact Microsoft Support (&lt;A href="http://support.microsoft.com/"&gt;http://support.microsoft.com/&lt;/A&gt;) and ask for the fix from KB article 934839.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1952824" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Getting real-time updates from remote process using the AJAX Extension</title><link>http://blogs.msdn.com/jorman/archive/2007/03/08/getting-real-time-updates-from-remote-process-using-the-ajax-extension.aspx</link><pubDate>Fri, 09 Mar 2007 01:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1840403</guid><dc:creator>Jorman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jorman/comments/1840403.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=1840403</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=1840403</wfw:comment><description>&lt;P&gt;This sample was a result of an idea from Kent Post at Akamai.&amp;nbsp; He was wanting to be able to launch a process on a remote server and get real-time updates in the browser.&amp;nbsp; In this case, we focused on running &lt;A class="" title="Windows Automated Installation Kit (WAIK)" href="http://www.microsoft.com/downloads/details.aspx?familyid=993c567d-f12c-4676-917f-05d9de73ada4&amp;amp;displaylang=en" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=993c567d-f12c-4676-917f-05d9de73ada4&amp;amp;displaylang=en"&gt;WinPE&lt;/A&gt; scripts to build ISO's on the server.&amp;nbsp; The WinPE scripts&amp;nbsp;can take a long time to process, and&amp;nbsp;the goal is to launch the process and see what was going on without having to be logged into the server console using the browser.&amp;nbsp; The attached sample provides a way to perform these actions by using &lt;A class="" title="System.Diagnostics.Process class information on MSDN" href="http://msdn2.microsoft.com/en-us/library/system.diagnostics.process(VS.80).aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/system.diagnostics.process(VS.80).aspx"&gt;System.Diagnostics&lt;/A&gt; to launch the process and the &lt;A class="" title="AJAX Extension web site" href="http://ajax.asp.net/" target=_blank mce_href="http://ajax.asp.net"&gt;AJAX Extension&lt;/A&gt; to get updates.&amp;nbsp; Before getting into the sample, let's look at some of the complications of doing this type of work.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Permissions on the server&lt;/STRONG&gt; - By default, the application pool running ASP.Net cannot run other processes on the server.&amp;nbsp; The process by default runs as Network Service which typically won't have Read access to the .bat, .cmd, .exe you're trying to run.&amp;nbsp; If you're writing files, it won't have access to write to directories either.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Getting the data back to the client&lt;/STRONG&gt; - Once you launch the process, how do you get the data down to a remote browser?&amp;nbsp; HTTP is a disconnected protocol, so once you spin up the process, you need some way of making additional requests and getting the output.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Application can not be interactive&lt;/STRONG&gt; - Making sure the application you're running does not have an interface that requires interaction.&amp;nbsp; Keep in mind you are launching a child process from a non-interactive service and there is no way for a remote or local user to actually interact with the program.&amp;nbsp; Batch files are good for this scenario.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The first obstacle is relatively easy to overcome.&amp;nbsp;&amp;nbsp;For&amp;nbsp;the demo, you can use a file based web site in Visual Studio 2005 and the built in web server.&amp;nbsp; In this&amp;nbsp;scenario, the web server and code run as&amp;nbsp;the account you are logged into the box&amp;nbsp;with and assuming this account&amp;nbsp;has&amp;nbsp;appropriate permissions to launch the program and write to any area that the program writes to, the app will work fine.&amp;nbsp; From a server perspective, we ran the Application Pool as Local System.&amp;nbsp; You can setup IIS with a new application pool running under local system and assign the application pool to the specific application to ensure other code is not running with elevated privileges.&amp;nbsp; Another option is to use PInvoke and call CreateProcessAsUser and explicitly set desktop permissions for the application pool account you're using.&amp;nbsp; This is a bit more complicated and won't be covered here.&amp;nbsp; If you're interested in looking into that approach for launching processes, check out Q165194&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A class="" title=#h1 name=#h1&gt;&lt;/A&gt;165194 - INFO: CreateProcessAsUser() Windowstations and Desktops&lt;BR&gt;&lt;A href="http://support.microsoft.com/support/kb/articles/Q165/1/94.asp" mce_href="http://support.microsoft.com/support/kb/articles/Q165/1/94.asp"&gt;http://support.microsoft.com/support/kb/articles/Q165/1/94.asp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The second problem of getting the output has a couple of options. One way to go is to pipe the output from the program to a text file and then redirect the browser to&amp;nbsp;the textfile.&amp;nbsp; If you haven't done this before, the following pipes the output of the dir command to the file c:\output.log:&amp;nbsp; &lt;STRONG&gt;dir &amp;gt;c:\ouptut.log&lt;/STRONG&gt;&amp;nbsp; This gets you the output after the application has completed execution.&amp;nbsp; However, in order to get the data as it's occurring, you have to make multiple requests to the server and access the StandardOutput stream directly.&amp;nbsp; In this sample, we use the &lt;A class="" title="Web Services with AJAX Tutorial" href="http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx" target=_blank mce_href="http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx"&gt;AJAX Extension&lt;/A&gt;, the &lt;A class="" title="setInterval documentation on MSDN" href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/setinterval.asp" target=_blank mce_href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/setinterval.asp"&gt;setInterval&lt;/A&gt; method in JavaScript, the &lt;A class="" title="System.Diagnostics.Process information on MSDN" href="http://msdn2.microsoft.com/en-us/library/system.diagnostics.process(VS.80).aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/system.diagnostics.process(VS.80).aspx"&gt;System.Diagnostics.Process&lt;/A&gt; class, and a custom class that's cached on the server to handle this scenario.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Overview of the sample&lt;/U&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;BR&gt;The attached files provide all the source to run the sample.&amp;nbsp; Here's a rundown of what the app does and&amp;nbsp;what is in the&amp;nbsp;.zip files.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;User browses Default.aspx - If the user&amp;nbsp;does not have a cookie called MyGUID, one is created for them.&amp;nbsp; The cookie value is used to uniquely identify the requests when making web service calls and for caching.&lt;/LI&gt;
&lt;LI&gt;User clicks the Launch button&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;JavaScript posts to the LaunchProcess method of the ProcessLauncher.asmx web service using the &lt;A class="" title="Web Services with AJAX Tutorial" href="http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx" mce_href="http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx"&gt;AJAX Extension&amp;nbsp;&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;LaunchProcess method does the following:&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;Creates an instance of the ProgramWatcher class&lt;/LI&gt;
&lt;LI&gt;Calls the Execute method of ProgramWatcher&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;Execute method launches a &lt;A class="" title="System.Thread.ThreadPool class information on MSDN" href="http://msdn2.microsoft.com/en-us/system.threading.threadpool.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/system.threading.threadpool.aspx"&gt;ThreadPool&lt;/A&gt; thread&lt;/LI&gt;
&lt;LI&gt;Runs the ReadLog.exe program&lt;/LI&gt;
&lt;LI&gt;Redirects the &lt;A class="" title="StandardOutput property information" href="http://msdn2.microsoft.com/en-us/system.diagnostics.process.standardoutput.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/system.diagnostics.process.standardoutput.aspx"&gt;StandardOutput&lt;/A&gt; of the ReadLog.exe program to a Stream property of the ProgramWatcher instance&lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;The ProgramWatcher instance is &lt;A class="" title="ASP.Net caching on MSDN" href="http://msdn2.microsoft.com/en-us/aa478965.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/aa478965.aspx"&gt;cached&lt;/A&gt; using the MyGUID cookie value from Step 1&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;
&lt;LI&gt;When the Async call returns,&amp;nbsp;a timer kicks off that runs the GetStatus JavaScript method after 750 milliseconds.&lt;/LI&gt;
&lt;LI&gt;GetStatus JavaScript method runs&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A class="" title="clearInterval documentation on MSDN" href="http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/clearinterval.asp" target=_blank mce_href="http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/clearinterval.asp"&gt;Timer is stopped&lt;/A&gt; to prevent async callbacks from getting out of sync.&amp;nbsp; i.e. IE can make 2 calls per server, this prevents 2 requests leaving the client and the 2nd request returning before the first request and messing up the output.&lt;/LI&gt;
&lt;LI&gt;GetStatus method of the ProcessLauncher webservice is called&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;GetStatus loads the ProgramWatcher method out of cache using the MyGUID cookie value&lt;/LI&gt;
&lt;LI&gt;Calls the ReadOutput method of the ProgramWatcher instance passing it how many bytes to read from the Stream property on ProgramWatcher - in this sample 50 bytes at a time.&lt;/LI&gt;
&lt;LI&gt;Returns the bytes returned from ReadOutput&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;
&lt;LI&gt;Client parses the response and handles output that contains \r vs. \r\n.&amp;nbsp; See the Issues section below for why this is important.&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Timer started again and Steps 4 -&amp;nbsp;5 occur again until the GetStatus method returns Null&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Included Files&lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;Here's a list of the files included in the .zip files with a summary of what they do.&amp;nbsp; The code is commented thoroughly.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&amp;nbsp;AjaxBatchProcess.zip&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;App_Code&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;ProgramWatcher.cs - This class is what drives the process on the server side.&amp;nbsp; It contains an Execute method that launches&amp;nbsp;a program via System.Diagnostics.Process and redirects the StandardOutput to a property on the class.&amp;nbsp; The class is cached so that the browser can get the output from the process in chunks.&lt;/LI&gt;
&lt;LI&gt;ProcessLauncher.cs - Web Service methods that allow the AJAX Extension to generate &lt;A class="" title="AJAX calling Web Service Info" href="http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx" target=_blank mce_href="http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx"&gt;JavaScript proxy classes&lt;/A&gt; that are used to launch the process on the web server and also get the output in chunks.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;AjaxBatchProcess.js - JavaScript file that calls the webservice methods and also handles getting and parsing&amp;nbsp;the output.&lt;/LI&gt;
&lt;LI&gt;Default.aspx - Page requested by an end user.&amp;nbsp; Has a &lt;A class="" title="ScriptManager documentation on ajax.asp.net" href="http://ajax.asp.net/docs/mref/T_System_Web_UI_ScriptManager.aspx" target=_blank mce_href="http://ajax.asp.net/docs/mref/T_System_Web_UI_ScriptManager.aspx"&gt;ScriptManager &lt;/A&gt;that hooks up AjaxBatchProcess.js and ProcessLauncher.asmx&lt;/LI&gt;
&lt;LI&gt;ProcessLauncher.asmx - Web Service requested by the client.&lt;/LI&gt;
&lt;LI&gt;Web.config - Web.config from the AJAX Extension project&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;ReadLog.zip&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;ReadLog.exe - Command-line program that reads the build_pe_out.txt file and pushes the output to the console.&lt;/LI&gt;
&lt;LI&gt;build_pe_out.txt - Output from WinPE commands.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;ReadLog-Source.zip&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Program.cs - source for the ReadLog program.&amp;nbsp; This program reads in a file passed in as an argument and pushes the text to the console.&lt;/LI&gt;
&lt;LI&gt;Default C# console project files &lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;P&gt;Here are the steps to use the files attached to the blog:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Unzip AjaxBatchProcess.zip to a folder in your file system.&lt;/LI&gt;
&lt;LI&gt;Unzip ReadLog.zip to c:\ReadLog&lt;/LI&gt;
&lt;LI&gt;Open Visual Studio 2005&lt;/LI&gt;
&lt;LI&gt;From the File menu | Select Open Web Site&lt;/LI&gt;
&lt;LI&gt;Select the path from Step 1 (the folder that contains app_code, default.aspx, etc. from the .zip file)&lt;/LI&gt;
&lt;LI&gt;Right-click Default.aspx, select View in Browser&lt;/LI&gt;
&lt;LI&gt;Click the Launch button&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Issues&lt;/U&gt;&lt;BR&gt;&lt;/STRONG&gt;I wanted to highlight a few areas and why we chose to go that route.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Caching the ProgramWatcher and the Stream property&lt;/STRONG&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;This is an important part of the application and is the piece that allows access to the output from the application in real-time.&amp;nbsp; In this case you have a program that is redirecting the StandardOutput to a Stream.&amp;nbsp; This is essentially writing bytes into memory with a pointer at the end.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;These are bytes&lt;/EM&gt;&amp;lt;StandardOutput Pointer&amp;gt;&lt;/P&gt;
&lt;P&gt;The ProgramWatcher class sets the StandardOutput stream to a property called Stream.&amp;nbsp; This gives you another pointer to the same bytes that starts at the beginning.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;lt;ProgramWatcher.Stream pointer&amp;gt;&lt;EM&gt;These are&amp;nbsp;bytes&lt;/EM&gt;&amp;lt;StandardOutput Pointer&amp;gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With this setup, you have the System.Diagnostics.Process adding bytes to the end of the stream via StandardOutput and ProgramWatcher.Stream reading the same bytes with a pointer that starts at the beginning.&amp;nbsp; The ProgramWatcher instance is cached so that when you Read bytes off of ProgramWatcher.Stream, you are&amp;nbsp;incrementing the pointer.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;These are&lt;/EM&gt; &amp;lt;ProgramWatcher.Stream pointer&amp;gt;&lt;EM&gt; bytes.&amp;nbsp; This is additional data&lt;/EM&gt; &amp;lt;StandardOutput Pointer&amp;gt;&lt;/P&gt;
&lt;P&gt;When the GetStatus method is called again, you are&amp;nbsp;accessing the same instance of the class, so the pointer is where you left it.&amp;nbsp; I was making this way to hard, so thanks to &lt;A class="" title="Todd Carter's blog" href="http://blogs.msdn.com/toddca" target=_blank mce_href="http://blogs.msdn.com/toddca"&gt;Todd Carter &lt;/A&gt;for helping clear this up.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;Parsing the \r and \r\n in the output returned by GetStatus&lt;/STRONG&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;This is important as console applications handle text ending in \r different than \r\n.&amp;nbsp; In the case of WinPE, you get output showing the percentage complete.&amp;nbsp; The text looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |6.0.6001.16464 |&amp;nbsp; +&amp;nbsp; | WinPE-FontSupport-JA-JP-Package&lt;STRONG&gt;\r\n&lt;/STRONG&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; 25.0%&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;STRONG&gt;\r&lt;/STRONG&gt;[===========================50.0%&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;STRONG&gt;\r&lt;/STRONG&gt;[============================75.0%===========&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; ]&lt;STRONG&gt;\r&lt;/STRONG&gt;&lt;BR&gt;[==========================100.0%==========================]&lt;STRONG&gt;\r\n&lt;/STRONG&gt;More Text&lt;/P&gt;
&lt;P&gt;In the console, this renders as the following when it is complete:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |6.0.6001.16464 |&amp;nbsp; +&amp;nbsp; | WinPE-FontSupport-JA-JP-Package&lt;BR&gt;More Text&lt;/P&gt;
&lt;P&gt;However, while the process is running, you would see the WinPE-FontSupport-JA-JP-Package line followed by the percentage.&amp;nbsp; When the next line ending in \r is written to the console, the previous line is replaced with the updated percentage.&amp;nbsp; The problem is that the browser doesn't handle \r and \r\n the same way.&amp;nbsp; So you would end up with the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |6.0.6001.16464 |&amp;nbsp; +&amp;nbsp; | WinPE-FontSupport-JA-JP-Package&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; 25.0%&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;STRONG&gt;&lt;BR&gt;&lt;/STRONG&gt;[===========================50.0%&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;STRONG&gt;&lt;BR&gt;&lt;/STRONG&gt;[============================75.0%===========&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; ]&lt;STRONG&gt;&lt;BR&gt;&lt;/STRONG&gt;[==========================100.0%==========================]&lt;STRONG&gt;&lt;BR&gt;&lt;/STRONG&gt;More Text&lt;/P&gt;
&lt;P&gt;Not real pretty.&amp;nbsp; In the sample, I parse the output and if the output ends in \r,&amp;nbsp;I put the information in the TextBox.&amp;nbsp; If the text ends in \r\n, I clear the textbox and add the line to the TextArea.&amp;nbsp; This gets pretty close to the same output you see in a console and avoids a lot of noise and clutter in the output.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hopefully this sample and the information provided will help anyone out there trying to solve similar issues.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1840403" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/jorman/attachment/1840403.ashx" length="24198" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Viewstate error in mobile ASP.NET app</title><link>http://blogs.msdn.com/jorman/archive/2007/01/10/viewstate-error-in-mobile-asp-net-app.aspx</link><pubDate>Wed, 10 Jan 2007 22:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1445628</guid><dc:creator>Jorman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jorman/comments/1445628.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=1445628</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=1445628</wfw:comment><description>&lt;P&gt;This is my third mobile post this week!&amp;nbsp; This one was tricky to track down so hopefully this will save someone some time.&amp;nbsp; The symptom you see is that users get the following exception.&amp;nbsp; If you're using ASP.NET 2.0, we would log this to the Event Viewer by default thanks to Web Events:&lt;/P&gt;
&lt;TABLE class="" style="COLOR: black; BACKGROUND-COLOR: beige"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;&lt;FONT size=2&gt;
&lt;P&gt;Exception of type 'System.Web.HttpUnhandledException' was thrown. ---&amp;gt; &lt;/P&gt;
&lt;P&gt;System.Exception: The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit.&lt;/P&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;This error would appear randomly throughout the day in a high throughput site.&amp;nbsp; We were able to track this down using the IIS logs, Network Monitor, and in this case, the exceptions logged in the Event Viewer.&amp;nbsp; The event logging in 2.0 captures a lot of information that is&amp;nbsp;useful for lining&amp;nbsp;up the exception with data gathered.&amp;nbsp; In this instance, we used the client IP linked to the request and then filtered the Network Monitor logs using this IP.&amp;nbsp; This allowed me to track the user's requests to see how they were using the site at the time of the failure.&lt;/P&gt;
&lt;P&gt;In this case, we could see the client making requests for a few minutes, then their traffic would go away for longer than the session timeout.&amp;nbsp; Their next request would come in for a page that they weren't browsing prior and would cause the exception.&amp;nbsp; Looking at this data, we determined that users were bookmarking the site on their mobile devices.&amp;nbsp; While this normally isn't a big deal, there are some devices that result in an __viewstate field in the QueryString.&amp;nbsp; When you bookmark this URL, the initial request is now going to cause the mobile page to lookup the viewstate which is stored in Session for mobile forms.&amp;nbsp; Since this is the first request, the session is just now being initialized, the ViewState isn't available, and the exception is thrown.&lt;/P&gt;
&lt;P&gt;You can avoid this problem by adding the following code to Session_Start in the global.asax or a HttpModule.&amp;nbsp; You can even get fancier and add some code to only remove the __viewstate QueryString if your pages are looking for other items in the QueryString collection.&amp;nbsp; This code will ensure that when a new session is being created, that the __viewstate QueryString is not part of that request.&lt;/P&gt;
&lt;TABLE class="" style="COLOR: black; BACKGROUND-COLOR: beige"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;&lt;FONT size=2&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void Session_Start(object sender, EventArgs e) &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; // Code that runs when a new session is started&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (HttpContext.Current.Request.QueryString.Count &amp;gt; 0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp; HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.LocalPath.ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;You could also track this down by logging the QueryString in the IIS logs and looking for __viewstate in that field.&amp;nbsp; The exception logged in the Event Viewer in 2.0 also log the UTC time to make it easy to line up the IIS entries which use UTC by default with the exception.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1445628" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Determining what capabilities ASP.NET is using to render pages</title><link>http://blogs.msdn.com/jorman/archive/2007/01/09/determining-what-capabilities-asp-net-is-using-to-render-pages.aspx</link><pubDate>Tue, 09 Jan 2007 22:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1440127</guid><dc:creator>Jorman</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/jorman/comments/1440127.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=1440127</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=1440127</wfw:comment><description>&lt;P&gt;When you make a request to an ASP.NET based site, the browser's capabilities are determined by the &amp;lt;browserCaps&amp;gt; section in the 1.x Framework and the .browser files in the 2.0 framework.&amp;nbsp; Knowing which capabilites that ASP.NET is using to render the page can be especially important in mobile applications.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;You can use the following page to return all the MobileCapabilities for the device by browsing the page:&lt;/P&gt;
&lt;TABLE class="" style="COLOR: black; BACKGROUND-COLOR: beige"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;&lt;FONT size=2&gt;
&lt;P&gt;&amp;lt;%&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;@&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;Page&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;language&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="c#"&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;AutoEventWireup&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="true"&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;Inherits&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="System.Web.UI.MobileControls.MobilePage"&lt;/FONT&gt;&lt;FONT size=2&gt; %&amp;gt;&lt;BR&gt;&amp;lt;%&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;@&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;Import&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;namespace&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="System.Web.Mobile"&lt;/FONT&gt;&lt;FONT size=2&gt; %&amp;gt;&lt;BR&gt;&amp;lt;%&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;@&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;Import&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;namespace&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="System.Reflection"&lt;/FONT&gt;&lt;FONT size=2&gt; %&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;script&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;runat&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="server"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;protected&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Page_Load(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Object&lt;/FONT&gt;&lt;FONT size=2&gt; sender, &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;EventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;{&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;MobileCapabilities&lt;/FONT&gt;&lt;FONT size=2&gt; capabilities = (&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;MobileCapabilities&lt;/FONT&gt;&lt;FONT size=2&gt;)Request.Browser;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Type&lt;/FONT&gt;&lt;FONT size=2&gt; t = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;typeof&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;MobileCapabilities&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;PropertyInfo&lt;/FONT&gt;&lt;FONT size=2&gt;[] propertyInfos = t.GetProperties();&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;PropertyInfo&lt;/FONT&gt;&lt;FONT size=2&gt; pi &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;FONT size=2&gt; propertyInfos)&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;{&lt;BR&gt;&lt;FONT color=#0000ff&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;System.Web.UI.MobileControls.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Label&lt;/FONT&gt;&lt;FONT size=2&gt; lbl = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;BR&gt;&lt;FONT color=#0000ff&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;System.Web.UI.MobileControls.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Label&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;&lt;FONT color=#0000ff&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;lbl.Text = pi.Name + &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;" = "&lt;/FONT&gt;&lt;FONT size=2&gt; + capabilities[pi.Name];&lt;BR&gt;&lt;FONT color=#0000ff&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Form1.Controls.Add(lbl);&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;script&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;mobile&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;:&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;Form&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;id&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=Form1&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;runat&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="server"&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;mobile&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;:&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;Form&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;The MobileCapabilities are determined by the UserAgent string that ASP.NET receives.&amp;nbsp; You can log the UserAgent string in the IIS logs or you can use a tool like &lt;A class="" title=Fiddler href="http://www.fiddlertool.com/fiddler/" target=_blank mce_href="http://www.fiddlertool.com/fiddler/"&gt;Fiddler&lt;/A&gt; or &lt;A class="" title="Web Development Helper" href="http://projects.nikhilk.net/Projects/WebDevHelper.aspx" mce_href="http://projects.nikhilk.net/Projects/WebDevHelper.aspx"&gt;Web Development Helper&lt;/A&gt; in IE to get this information.&amp;nbsp; Once you have the UserAgent string, you can use Fiddler to pass the same UserAgent string while browsing in IE.&amp;nbsp; This will give you a larger viewing area for looking at hte list of MobileCapabilities.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1440127" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Mobile ASP.NET Emulators</title><link>http://blogs.msdn.com/jorman/archive/2007/01/08/mobile-asp-net-emulators.aspx</link><pubDate>Mon, 08 Jan 2007 23:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1435949</guid><dc:creator>Jorman</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jorman/comments/1435949.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=1435949</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=1435949</wfw:comment><description>&lt;P&gt;When developing Mobile ASP.NET apps, it is useful to test the application across a variety of devices if the site is going to be posted to the internet.&amp;nbsp; ASP.NET Mobile controls rely on adapters to handle rendering on the different devices.&amp;nbsp; In order to hit the different adapters to ensure your page will work across the devices, you can use emulators.&amp;nbsp; While troubleshooting mobile issues, I typically use the following emulators:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;HTML3.2 - I use Internet Explorer or one of the Pocket PC/Smartphone emulators that ship with Visual Studio.&amp;nbsp; The default rendering for these devices is HTML 3.2 and as a result, the mobile controls will use the HTML32 adapters to render.&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;WML - I use the OpenWave 7 emulator that comes as part of the OpenWave 7 SDK.&amp;nbsp; ASP.NET picks up this device with a default rendering of WML allowing the mobile controls to use the WML adapters for rendering.&lt;/LI&gt;
&lt;LI&gt;XHTML - I use the OpenWave 6.2.2 emulator.&amp;nbsp; The default rendering for this device is XHTML.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;You can also use the &amp;lt;browserCaps&amp;gt;&amp;nbsp;section in machine.config (1.x Framework) or .browser files (2.x Framework) to force the preferredRenderingType property of a device, however, I have found that using the emulators is quicker for testing against.&lt;/P&gt;
&lt;P&gt;OpenWave emulators can be found here: &lt;A href="http://developer.openwave.com/dvl/tools_and_sdk/phone_simulator/" mce_href="http://developer.openwave.com/dvl/tools_and_sdk/phone_simulator/"&gt;http://developer.openwave.com/dvl/tools_and_sdk/phone_simulator/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The Pocket PC/Smartphone emulators are available on the Tools menu, under the Connect to Device option.&lt;/P&gt;
&lt;P mce_keep="true"&gt;If you have a specific device and ASP.NET is not rendering the right content; i.e. your device supports JavaScript, but you're not getting JavaScript; you can use the Device Profiling Tool to generate a profile of the device and generate a &amp;lt;browserCaps&amp;gt; section (1.x) or a .browser file(2.0).&amp;nbsp; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;If you need to build a section for &amp;lt;browserCaps&amp;gt;, you can do this online here:&amp;nbsp; &lt;BR&gt;&lt;A href="http://www.asp.net/mobile/profile/default.aspx" mce_href="http://www.asp.net/mobile/profile/default.aspx"&gt;http://www.asp.net/mobile/profile/default.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;If you need to generate a .browser file you can download the device profiler and run it locally:&lt;BR&gt;&lt;A href="http://www.asp.net/sandbox/app_devprof.aspx?tabid=62" mce_href="http://www.asp.net/sandbox/app_devprof.aspx?tabid=62"&gt;http://www.asp.net/sandbox/app_devprof.aspx?tabid=62&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;You can find links to training and mobile ASP.NET development here:&amp;nbsp; &lt;A href="http://www.asp.net/default.aspx?tabIndex=6&amp;amp;tabId=44" mce_href="http://www.asp.net/default.aspx?tabIndex=6&amp;amp;tabId=44"&gt;http://www.asp.net/default.aspx?tabIndex=6&amp;amp;tabId=44&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1435949" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>JavaScript Fun!</title><link>http://blogs.msdn.com/jorman/archive/2006/11/22/javascript-fun.aspx</link><pubDate>Thu, 23 Nov 2006 01:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1124189</guid><dc:creator>Jorman</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jorman/comments/1124189.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=1124189</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=1124189</wfw:comment><description>&lt;P&gt;I was recently working with JavaScript and ran into some weird things I hadn't ran into before.&amp;nbsp; While I'm sure the JavaScript masters of the world already know all about this stuff, hopefully this post can keep others from pulling out too much hair.&amp;nbsp; The first one deals with scoping:&lt;/P&gt;
&lt;P&gt;If you don’t explicitly var an object, that object is declared globally.&amp;nbsp; The code will typically not fail, however, it will give you odd behavior.&amp;nbsp; This becomes an issue if you have the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;function Loop1(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(x = 0; x &amp;lt; 10; x++){&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; Loop2();&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; alert(x);&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function Loop2(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(x = 0; x &amp;lt; 10; x++){&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; //do work here&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;/P&gt;
&lt;P&gt;You would expect the alert to occur 10 times, however, since the x declared in the first for loop does not have var in front of it, the variable is global.&amp;nbsp; When Loop2 is called, the loop increments x to 10 causing the for loop in Loop1 to only occur 1 time.&amp;nbsp; To correct this code, change the for loops to:&lt;BR&gt;for(var x = 0; x &amp;lt; 10; x++)&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;The other issue deals with naming of objects and functions.&amp;nbsp; If you're developing everything it's no big deal as you will typically know what the ID's will be on the client as well as the names of JavaScript functions, but if you're leveraging someone's JavaScript library, this can become more interesting.&amp;nbsp;&amp;nbsp; The error you get&amp;nbsp;in Internet Explorer is&amp;nbsp;"Object doesn't support this property or method".&amp;nbsp; The following line will reproduce the behavior, but imagine if you had a page with 50 controls and the function name that matches is in a JavaScript file you didn't write:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;lt;input type="button" id="AbortCallback" value="Abort" onclick="AbortCallback()" /&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1124189" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Custom WebPart Catalog</title><link>http://blogs.msdn.com/jorman/archive/2006/10/05/Custom-WebPart-Catalog.aspx</link><pubDate>Thu, 05 Oct 2006 23:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:794569</guid><dc:creator>Jorman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jorman/comments/794569.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=794569</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=794569</wfw:comment><description>&lt;P&gt;Trying to catch back up on my blogging, I have a list of topics to post on, just haven't had time to get to them.&amp;nbsp; I wrote this article over a month ago...figured I would link it up from here. &lt;/P&gt;
&lt;P&gt;The default web part catalogs that are shipped with ASP.Net&amp;nbsp;require you to configure the list of web parts you want to display in your catalog.&amp;nbsp; We've had a few requests for a more dynamic approach and the article has a sample that can get you started on this.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.microsoft.com/kb/910446" mce_href="http://support.microsoft.com/kb/910446"&gt;http://support.microsoft.com/kb/910446&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The article links up to a sample Solution and lays out the files and what they do.&amp;nbsp; The main piece is a custom web part catalog that uses reflection to populate the list of web parts.&amp;nbsp; The idea is that you drop a .dll into the /bin folder of your app and the catalog will automatically pick out the web part controls in the dll.&amp;nbsp; It caches the list of parts to avoid the cost of looking up the dll's on future requests.&amp;nbsp; This works great since adding a dll to the /bin will recycle the app domain and clear the cache, so all you need to do to add web parts to the catalog is to add the dll to the /bin.&lt;/P&gt;
&lt;P&gt;The other piece is a custom WebPart that pulls data from an RSS feed and shows the different types of properties you can implement in the web part.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=794569" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>System.InvalidOperationException: Mutex could not be created.</title><link>http://blogs.msdn.com/jorman/archive/2006/07/24/system-invalidoperationexception-mutex-could-not-be-created.aspx</link><pubDate>Mon, 24 Jul 2006 16:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:676660</guid><dc:creator>Jorman</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/jorman/comments/676660.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=676660</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=676660</wfw:comment><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;We've seen a few of these issues come through lately andwanted to get something posted so people can find it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;If you created a custom account to run the process that ASP.NET is running in, you may encounter the following exception:&lt;/FONT&gt;&lt;/P&gt;
&lt;TABLE class="" style="COLOR: black; BACKGROUND-COLOR: beige"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;System.InvalidOperationException: Mutex could not be created.&lt;BR&gt;&lt;BR&gt;Stack Trace:&amp;nbsp;&lt;BR&gt;[InvalidOperationException: Mutex could not be created.]&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Web.Compilation.CompilationMutex..ctor(String name, String comment) +3464689&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Web.Compilation.CompilationLock..cctor() +158&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;[TypeInitializationException: The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.]&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Web.Compilation.CompilationLock.GetLock(Boolean&amp;amp; gotLock) +32&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +114&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;[HttpException (0x80004005): The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.]&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3426871&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +149&lt;BR&gt;--------------------------------------------------------------------------------&lt;BR&gt;Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Note:&amp;nbsp; The error will appear to be random, but once it appears, will remain until a reboot or until the handles to the mutex are closed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Cause:&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;======&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;This occurs because the permissions on the following registry key no longer have your custom account:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727.0\CompilationMutexName&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The compilation mutex gets it's permissions from this registry key and with your custom account missing, the process running ASP.NET cannot get a handle to the mutex and fails during compilation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial size=2&gt;Resolution:&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;=========&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Run the following to add your custom account to the registry key permissions:&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ASPNET_regiis -ga domain\account.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Either restart the server or close the handles to the mutex (see below)&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;To close the handles to the Mutex:&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Download and launch Process Explorer from &lt;/FONT&gt;&lt;A href="http://www.sysinternals.com/" mce_href="http://www.sysinternals.com/"&gt;&lt;FONT face=Arial size=2&gt;&lt;A href="http://www.sysinternals.com/" mce_href="http://www.sysinternals.com/"&gt;www.sysinternals.com&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/A&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;From the Find menu, select Find Handle or DLL&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;In the Handle or DLL substring box, type “mutant” (without quotes) and click Search&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click the Handle or DLL column heading to sort the items and find a mutex that starts with CL.&amp;nbsp; The handle will typically be devenv.exe (the IDE for Visual Studio) and aspnet_wp.exe or w3wp.exe.&amp;nbsp; The handle will look similar to:&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;\BaseNameObjects\CLbdd6aa8f&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Select the handle in the search box and Process Explorer locates the Process and the handle in the main window&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Right-click the handle in the main window and select Close Handle&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Additional Info:&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;============&lt;/STRONG&gt;&lt;BR&gt;The error may occur anytime you run ASP.NET as a custom account and the above mentioned registry key does not have the account listed in the permissions.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;If you receive the error and you are running with a custom account on IIS 6 in worker process mode (code running in w3wp.exe), you can add your custom account to the IIS_WPG group on the server.&amp;nbsp; The IIS_WPG group is granted access to the registry key by default.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=676660" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Vista + IIS 7 + Local IIS web site = error?</title><link>http://blogs.msdn.com/jorman/archive/2006/06/06/vista-iis-7-local-iis-web-site-error.aspx</link><pubDate>Tue, 06 Jun 2006 20:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:619246</guid><dc:creator>Jorman</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/jorman/comments/619246.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=619246</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=619246</wfw:comment><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Finally got around to getting a clean install of Vista Beta 2 on my laptop and of course the first thing I install is Visual Studio 2005 and IIS 7 to see how the Local IIS option is going to play with the newly revamped IIS.&amp;nbsp; Well, if you choose the default options, this is the message you get when selecting Local IIS in the Open/Create Web Site dialog:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial size=2&gt;You must be a member of the Administrators group on the local computer to access the IIS metabase. Therefore, you cannot create or open a local IIS Web site. If you have Read, Write, and Modify permissions for the folder where the files are located, you can create a file system Web site that points to the folder in order to edit the files.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Initially I'm thinking this is the User Account Control feature in Vista blocking me from accessing the metabase.&amp;nbsp; So I turned that off in the Local Security Policy and still no go.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I then remembered an IIS 6 option under the Windows Features install dialog under Internet Information Services and found the following option that allows VS 2005 to play with IIS 7....IIS Metabase and IIS 6 configuration compatibility.&amp;nbsp; Here are the steps:&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Open Control Panel&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Open Programs&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Open Windows Features&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Expand Internet Information Services&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Expand Web Management Tools&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Expand IIS 6 Management Compatibility&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Check IIS Metabase and IIS 6 configuration compatibility&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click OK&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Here is another blog that discusses debugging in this environment:&lt;BR&gt;&lt;A href="http://mvolo.com/blogs/serverside/archive/2006/12/28/Fix-problems-with-Visual-Studio-F5-debugging-of-ASP.NET-applications-on-IIS7-Vista.aspx" mce_href="http://mvolo.com/blogs/serverside/archive/2006/12/28/Fix-problems-with-Visual-Studio-F5-debugging-of-ASP.NET-applications-on-IIS7-Vista.aspx"&gt;http://mvolo.com/blogs/serverside/archive/2006/12/28/Fix-problems-with-Visual-Studio-F5-debugging-of-ASP.NET-applications-on-IIS7-Vista.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Hopefully this can save somebody some time when/if they run into it.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=619246" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>ASP.NET tab forces restart of W3SVC</title><link>http://blogs.msdn.com/jorman/archive/2006/04/14/asp-net-tab-forces-restart-of-w3svc.aspx</link><pubDate>Fri, 14 Apr 2006 20:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:576605</guid><dc:creator>Jorman</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/jorman/comments/576605.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=576605</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=576605</wfw:comment><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;If you change the version on the ASP.NET tab that comes with the 2.0 Framework, the entire W3SVC process restarts.&amp;nbsp; If you make this type of change during a maintenance window, the impact may not be too bad, but if you have multiple application pools in IIS and need to make this type of change during the day, all the application pools will recycle.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You can avoid this problem by running the following commands.&amp;nbsp; The first command configures the mappings in IIS and uses the -norestart command to tell aspnet_regiis to not restart the W3SVC service.&amp;nbsp; The second command restarts the IIS Application Pool:&lt;/FONT&gt;&lt;/P&gt;
&lt;OL dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;%windir%\Microsoft.Net\Framework\&amp;lt;version&amp;gt;\aspnet_regiis -s &amp;lt;path&amp;gt; -norestart&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;%windir%\system32\iisapp.vbs /a&amp;nbsp;&amp;lt;app pool&amp;gt; -r&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;It's important to note that it is not supported to run both 1.1 and 2.0 framework in the same application pool.&amp;nbsp; For example, you can't have /MyApp mapped to the 1.1 framework in an application pool called MyAppPool and also have /AnotherApp mapped to the 2.0 framework in the same application pool.&amp;nbsp; The symptom you will see&amp;nbsp;is a Server Application Unavailable messa&lt;FONT color=#ffffff&gt;ge in the browser.&amp;nbsp; You will also get the following event in the Application Event Log:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;TABLE class="" style="COLOR: black; BACKGROUND-COLOR: beige"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Event Type:&amp;nbsp;Error&lt;BR&gt;Event Source:&amp;nbsp;ASP.NET 2.0.50727.0&amp;nbsp; &amp;lt;could also be 1.1.4322&amp;gt;&lt;BR&gt;Event ID:&amp;nbsp;1062&lt;BR&gt;Description:&lt;BR&gt;It is not possible to run two different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT color=#ffffff&gt;&lt;FONT style="BACKGROUND-COLOR: #000000"&gt;This requires that you&lt;/FONT&gt; know the IIS metabase path to the app; something like /w&lt;/FONT&gt;3svc/1/root/myapp if the application is under Default Web Site.&amp;nbsp; You also have to know the application pool which would require you to look it up in IIS.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I've attached a .vbs file that helps to automate this process.&amp;nbsp; Feel free to modify it however you see fit.&amp;nbsp; It takes in the name of the web site; i.e. "Default Web Site", the version of the framework you want to map, and the virtual path to the app you want to configure.&amp;nbsp; It's much easier to remember "Default Web Site" or "Intranet", than it is to remember the instance number of 578954321 :)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Example command lines:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp; Configure the Default Web Site for ASP.NET 2.0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ASPNETMapping_norestart.vbs website "Default Web Site" version 2.0&lt;BR&gt;&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp; Configure the Default Web Site for ASP.NET 1.1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ASPNETMapping_norestart.vbs website "Default Web Site" version 1.1&lt;BR&gt;&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp; Configures the /mywebapp application for ASP.NET 2.0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ASPNETMapping_norestart.vbs website "Default Web Site" apppath "/mywebapp" version 2.0&lt;BR&gt;&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp; Configures the /anotherapp application on the web site named Intranet for 2.0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ASPNETMapping_norestart.vbs website "Intranet" apppath "/anotherapp" version 2.0&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;A href="http://blogs.msdn.com/jorman/attachment/576605.ashx" mce_href="http://blogs.msdn.com/jorman/attachment/576605.ashx"&gt;Download the file here&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=576605" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/jorman/attachment/576605.ashx" length="1807" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Session loss after migrating to ASP.NET 2.0</title><link>http://blogs.msdn.com/jorman/archive/2006/03/05/session-loss-after-migrating-to-asp-net-2-0.aspx</link><pubDate>Mon, 06 Mar 2006 00:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:544119</guid><dc:creator>Jorman</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jorman/comments/544119.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=544119</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=544119</wfw:comment><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;The HttpOnly attribute has been added to the Session cookie generated by ASP.NET 2.0.&amp;nbsp; This value is hardcoded and cannot be changed via a setting in the application.&amp;nbsp; While this is documented as a breaking change in the breaking changes document (linked below), it's not clear the types of symptoms you will see in your application, nor is the fix clearly stated.&lt;BR&gt;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/netframework/programming/breakingchanges/runtime/aspnet.aspx" mce_href="http://msdn.microsoft.com/netframework/programming/breakingchanges/runtime/aspnet.aspx"&gt;&lt;STRONG&gt;&lt;BR&gt;&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE class="" style="COLOR: black; BACKGROUND-COLOR: beige"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;void Application_EndRequest(object sender, EventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Response.Cookies.Count &amp;gt; 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (string s in Response.Cookies.AllKeys)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (s == FormsAuthentication.FormsCookieName || s.ToLower() == "asp.net_sessionid")&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; {&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Cookies[s].HttpOnly = false;&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; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&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; }&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You could also roll this into a custom HttpModule to apply it across multiple applications if necessary.&lt;BR&gt;&lt;BR&gt;Link to breaking changes document:&lt;BR&gt;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/netframework/programming/breakingchanges/runtime/aspnet.aspx" mce_href="http://msdn.microsoft.com/netframework/programming/breakingchanges/runtime/aspnet.aspx"&gt;&lt;FONT face=Arial size=2&gt;http://msdn.microsoft.com/netframework/programming/breakingchanges/runtime/aspnet.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;Link to HttpOnly Attribute:&lt;BR&gt;&lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.web.httpcookie.httponly.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.web.httpcookie.httponly.aspx"&gt;&lt;FONT face=Arial size=2&gt;http://msdn2.microsoft.com/en-us/library/system.web.httpcookie.httponly.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;Link to HttpModule documentation:&lt;BR&gt;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhttpmodules.asp" mce_href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhttpmodules.asp"&gt;&lt;FONT size=2&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhttpmodules.asp&lt;/FONT&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Special thanks to Shai Zohar for helping isolate the issue as well as testing the above solution.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=544119" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Another SSL Termination/Acceleration gotcha in 2.0</title><link>http://blogs.msdn.com/jorman/archive/2006/03/03/another-ssl-termination-acceleration-gotcha-in-2-0.aspx</link><pubDate>Sat, 04 Mar 2006 00:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:543231</guid><dc:creator>Jorman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jorman/comments/543231.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=543231</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=543231</wfw:comment><description>&lt;P&gt;In 1.1, we used the requireSSL attribute to ensure that the FormsAuthentication cookie has the secure attribute set.&amp;nbsp; In 2.0, if you have requireSSL set, we'll remove the cookie from the incoming request if the web server receives the cookie over a non-secure connection.&lt;/P&gt;
&lt;P&gt;Client --&amp;gt; SSL --&amp;gt; Device --&amp;gt; Http --&amp;gt; Server&lt;/P&gt;
&lt;P&gt;Here's the rundown of what goes on:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;User logs in successfully.&amp;nbsp; Cookie is created and the .secure attribute is set because requireSSL is true.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;Client gets the cookie and sends it on the next request because the client's connection is secure.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;The device handling SSL decrypts the traffic and sends clear traffic to the server.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;The FormsAuthenticationModule checks for requireSSL being set and the connection being unsecure and removes the cookie.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;When the HttpContext gest to the UrlAuthorizationModule to do it's validation based on an anonymous request and sets the response to a 401.&amp;nbsp; The end result is you get redirected to the login page.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The moral of the story...if you use SSL Termination with FormsAuthentication and need to ensure the .secure attribute is set on the FormsAuthentication cookie, you'll have to do it programmatically.&lt;FONT size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=543231" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Nonsecure items message using Menu control over SSL</title><link>http://blogs.msdn.com/jorman/archive/2006/02/06/nonsecure-items-message-using-menu-control-over-ssl.aspx</link><pubDate>Tue, 07 Feb 2006 01:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:526087</guid><dc:creator>Jorman</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/jorman/comments/526087.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=526087</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=526087</wfw:comment><description>&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;If you're using the new menu control that ships with ASP.NET 2.0 and SSL Termination/Acceleration, you will run into this issue.&amp;nbsp;&amp;nbsp; The behavior the end users will see is a warning in the browser stating something similar to:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;FONT color=#ff0000&gt;This page contains both secure and nonsecure items. &lt;BR&gt;Do you want to display the nonsecure items?&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;The user is browsing using HTTPS, so where is the non-secure item?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;This is actually caused by the way the menu control was implemented.&amp;nbsp; When you hover over a menu item, the popup menu is created using frames.&amp;nbsp; For performance reasons, if the URL that the server receives is HTTP, the script that builds the popup menu uses about:blank as the default page.&amp;nbsp; This is done to increase performance since the browser won't have to make another request to the web server just to temporarily populate a frame.&amp;nbsp; If the server receives the URL as HTTPS, the script actually makes a request back to the server to an HTTPS address to populate the frame.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;So...if you use SSL termination or SSL acceleration you end up with the following network architecture:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Client --&amp;gt; SSL --&amp;gt; Termination/Acceleration device --&amp;gt; HTTP --&amp;gt; Web Server&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Even though the client is using SSL, the web server is getting HTTP traffic.&amp;nbsp; As a result, the menu control does not inject the script to populate the popup using an SSL address.&amp;nbsp; When the client hovers over the menu item, the popup tries to go to about:blank.&amp;nbsp; This is considered a protocol transfer in IE which causes the warning to display.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;That was a bit long winded, but it's good to know why your getting an message before trying to change it :)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;The easiest way to get the warning to go away is to manually inject the line of script that forces the client to populate the popup using an SSL address.&amp;nbsp; This would look like:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&amp;lt;script runat="server"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; protected override void Render(HtmlTextWriter writer) &lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Page.ClientScript.RegisterStartupScript(typeof(Page), "MenuHttpsWorkaround", Menu1.ClientID + "_Data.iframeUrl='https://myserver/someblankpage.htm';", true);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; base.Render(writer);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;lt;/script&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=526087" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Debug javascript generated by webresource.axd</title><link>http://blogs.msdn.com/jorman/archive/2006/01/23/debug-javascript-generated-by-webresource-axd.aspx</link><pubDate>Tue, 24 Jan 2006 07:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:516632</guid><dc:creator>Jorman</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jorman/comments/516632.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jorman/commentrss.aspx?PostID=516632</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jorman/rsscomments.aspx?PostID=516632</wfw:comment><description>&lt;P&gt;&lt;FONT size=2&gt;Ran across this the other day and thought someone else may find it useful.&amp;nbsp; Javascript for the ASP.Net 2.0 controls is typically generated by a request to webresource.axd.&amp;nbsp; For example when you add a menu control, you see the following in the page:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&amp;lt;script src="http://blogs.msdn.com/myapp/WebResource.axd?d=oTrMXXyr9lkT4MbMovPbCw2&amp;amp;amp;t=632681794331014707" mce_src="http://blogs.msdn.com/myapp/WebResource.axd?d=oTrMXXyr9lkT4MbMovPbCw2&amp;amp;amp;t=632681794331014707" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;If you browse the above URL, you get a .js file as output.&amp;nbsp; If you wanted to debug this script (or other .js files) at runtime, you can use the Script Explorer included with Visual Studio 2005.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT size=2&gt;Ensure IE is setup for debugging (Internet Options | Advanced tab).&amp;nbsp; After you enable debugging in IE, you must restart the browser. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT size=2&gt;Attach the debugger to the browser.&amp;nbsp; You can do this by pressing F5 in Visual Studio 2005 or by using Attach to Process on the Debug menu. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT size=2&gt;From the Debug menu, select Windows, then Script Explorer (keyboard shortcut Ctrl+Alt+N).&amp;nbsp; The page and script files open in the browser are displayed. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT size=2&gt;Double-click the page to open the HTML output of the page &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT size=2&gt;Double-click the script file &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT size=2&gt;Set breakpoints and perform an action to trigger the script&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;FONT size=2&gt;To debug inline script, you can either move the script to a .js file, use stop commands, or set a function breakpoint.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;If Script Explorer is missing for you, you can use the keyboard shortcut (Ctrl+Alt+N), or add it to the IDE.&amp;nbsp; Here's how to add in the Script Explorer to a toolbar or menu:&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT size=2&gt;Tools menu, select Customize&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT size=2&gt;Command Tab&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT size=2&gt;Select Debug on the left, find Script Explorer on the right&amp;nbsp;&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT size=2&gt;Drag Script Explorer to a toolbar or menu&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=516632" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jorman/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item></channel></rss>