<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://dotnetqpearl.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Ahmed Abd El Kader</title><subtitle type="html" /><id>http://dotnetqpearl.net/blogs/securesign/atom.aspx</id><link rel="alternate" type="text/html" href="http://dotnetqpearl.net/blogs/securesign/default.aspx" /><link rel="self" type="application/atom+xml" href="http://dotnetqpearl.net/blogs/securesign/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.60809.935">Community Server</generator><updated>2007-03-19T18:50:00Z</updated><entry><title>Versions of the .NET Framework and the IIS6 Application Pools</title><link rel="alternate" type="text/html" href="http://dotnetqpearl.net/blogs/securesign/archive/2007/03/31/Versions-of-the-.NET-Framework-and-the-IIS6-Application-Pools.aspx" /><id>http://dotnetqpearl.net/blogs/securesign/archive/2007/03/31/Versions-of-the-.NET-Framework-and-the-IIS6-Application-Pools.aspx</id><published>2007-03-31T10:15:00Z</published><updated>2007-03-31T10:15:00Z</updated><content type="html">&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;font size="2"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/VD2-Application-Pool-R.aspx" target="_blank"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;When a new version of any technology appears, there are always new rules to be considered.&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;As part of my job as a Web Administrator, I used to test the new web technologies on Testing Environment before applying it on the real one. Microsoft has made the .NET Framework starting with Version 1.0 followed by v1.1 and now there are new releases v2.0 and v3.0. Microsoft gave them the ability to run together on the same server at the same time.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;&lt;font size="3"&gt;Concepts&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;The same site can only run under one version of the .NET Framework. But if we have more than one Virtual Directory on that site, we can choose for each one of them to run on a different version of the .NET Framework.&lt;/span&gt;&lt;span style="font-size:11pt;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/images/35/original.aspx" target="_blank"&gt;&lt;img border="0" height="48" src="http://dotnetqpearl.net/photos/web_administration/images/35/original.aspx" width="125" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;IIS 6.0 uses the IIS 6.0 process model (&lt;em&gt;&lt;span style="font-family:Arial;"&gt;w3wp.exe&lt;/span&gt;&lt;/em&gt;) and uses an isolation feature called application pooling. Application pooling enables applications to run together in one or more processes, as long as they share the same pool designation.&lt;/span&gt;&lt;span style="font-size:11pt;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Applications that are assigned different application pools never run in the same process.&lt;/span&gt;&lt;span style="font-size:11pt;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture38.aspx" target="_blank"&gt;&lt;img border="0" height="446" src="http://dotnetqpearl.net/photos/web_administration/images/38/original.aspx" width="403" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-family:Arial;"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;The Web Administrator can put the site and it&amp;#39;s Virtual Directories in the same Application Pool.&lt;/span&gt;&lt;span style="font-size:11pt;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture36.aspx" target="_blank"&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture36.aspx" target="_blank"&gt;&lt;img border="0" height="48" src="http://dotnetqpearl.net/photos/web_administration/images/36/original.aspx" width="125" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;He can also put each Virtual Directory in a different one.&lt;/span&gt;&lt;span style="font-size:11pt;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture37.aspx" target="_blank"&gt;&lt;img border="0" height="48" src="http://dotnetqpearl.net/photos/web_administration/images/37/original.aspx" width="125" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;When there is more than one version of the .NET Framework run on your server, they cannot be together on the same process. Every application pool have its own worker possess or/Processes. So every .NET Framework version must run on a different Application Pool.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;All of those concepts will lead to one rule:&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;&lt;font size="3"&gt;The Rule&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;You cannot run more than one version of the framework in the same application pool.&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p&gt;&lt;span style="font-size:11pt;color:windowtext;font-family:Arial;"&gt;If you try to do so you will see this error appears:&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;table align="center"&gt;&lt;tr&gt;&lt;td&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="color:#ff3300;font-family:Verdana;"&gt;Server Application Unavailable&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:10pt;font-family:Verdana;"&gt;The web application you are attempting to access on this web server is currently unavailable.&amp;nbsp; Please hit the &amp;quot;Refresh&amp;quot; button in your web browser to retry your request.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:10pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;Take a look at your event viewer and you will &lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;receive Event ID 1062 that says:&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;table align="center"&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:10pt;font-family:Arial;"&gt;&amp;quot;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.&amp;quot;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;How to make your Application Available again&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="2"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;When you need to run a different version of the .NET Framework on a different Virtual Directories inside the site, you need to create a different Application Pool and assign for each Virtual Directory one of the Application Pools that you have created. Then you can make each one of this Virtual Directory run on a different version of the .NET Framework.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Note:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt; To &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:Verdana;"&gt;reduce overhead and resource consumption. Just have a separate pool for each version of the Framework and run all like Virtual Directories in the same pool&lt;/span&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;In this example we have one site with two Virtual Directories and we need to run each one of them on a different version of the .NET Framework and assign for each one a different application pool.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="2"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;Create Two New Application Pools&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Start Internet Information Services (IIS) Manager. &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Expand the Application Pools Node - Right-click the Node, - New &amp;gt; Application Pool. &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;In the Add New Application Pool dialog box, type &amp;quot;&lt;/span&gt;&lt;/font&gt;&lt;font color="#660000" face="Courier New, Courier, monospace" size="2"&gt;AppPoolName&lt;/font&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&amp;quot; in the Application Pool ID text box. Leave the Use default settings for new application pool option selected, and click OK. Your new &amp;quot;&lt;font color="#660000" face="Courier New, Courier, monospace" size="2"&gt;AppPoolName&lt;/font&gt;&amp;quot; will be created. &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;strong&gt;Application Pool 1:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture39.aspx" target="_blank"&gt;&lt;img border="0" height="215" src="http://dotnetqpearl.net/photos/web_administration/images/39/original.aspx" width="398" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;strong&gt;Application Pool 2:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture40.aspx" target="_blank"&gt;&lt;img border="0" height="215" src="http://dotnetqpearl.net/photos/web_administration/images/40/original.aspx" width="398" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-family:Arial;"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;Assign for each Virtual Directory a different application pool.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Virtual Directory VD1:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/span&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;1. Right-click VD1 Virtual Directory &amp;gt; Properties&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;2. On Directory Tab &amp;gt; Choose the &lt;font color="#660000" face="Courier New, Courier, monospace" size="2"&gt;VD1AppPool &lt;/font&gt;&lt;font size="3"&gt;from the DropDownList in the Application Pool section. &lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&amp;nbsp;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture41.aspx" target="_blank"&gt;&lt;img border="0" height="438" src="http://dotnetqpearl.net/photos/web_administration/images/41/original.aspx" width="472" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Do the same for the VD2 Virtual Directory.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;font size="2"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/VD2-Application-Pool-R.aspx" target="_blank"&gt;&lt;img border="0" height="438" src="http://dotnetqpearl.net/photos/web_administration/images/original/VD2-Application-Pool-R.aspx" width="472" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="2"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;Choose for each Virtual Directory to run under different versions of the .NET Framework.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;ol&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt 0.5in;direction:ltr;unicode-bidi:embed;text-align:left;tab-stops:list .5in;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Right-click VD1 Virtual Directory &amp;gt; Properties &lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt 0.5in;direction:ltr;unicode-bidi:embed;text-align:left;tab-stops:list .5in;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;On ASP.NET Tab &amp;gt; Choose the .NET Framework 1.1 from the DropDownList in the ASP.NET Version section. &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture43.aspx" target="_blank"&gt;&lt;img border="0" height="438" src="http://dotnetqpearl.net/photos/web_administration/images/43/original.aspx" width="471" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Do the same for the VD2 Virtual Directory.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;a href="http://dotnetqpearl.net/photos/web_administration/picture44.aspx" target="_blank"&gt;&lt;img border="0" height="438" src="http://dotnetqpearl.net/photos/web_administration/images/44/original.aspx" width="471" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;Now your applications on each Virtual Directory will run successfully under different Versions of the .NET Framework.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;strong&gt;Important Note:&lt;/strong&gt; &lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;In the example I have just assumed that we have just two Virtual Directories ...But if we have 10 Virtual Directories and we need to have a separate pool for each version of the .NET Framework, We will run all like Virtual Directories in the same pool.&lt;br /&gt;&lt;br /&gt;If there are 5 Virtual Directories on .Net 1.1 and another 5 Virtual Directories are on .Net 2.0&lt;br /&gt;&lt;br /&gt;there will be just two Application Pools:&lt;br /&gt;&lt;br /&gt;&amp;quot;&lt;/span&gt;&lt;span style="font-size:11pt;color:maroon;"&gt;&lt;font face="Times New Roman"&gt;AppPoolFor1.1&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&amp;quot;&lt;br /&gt;&lt;br /&gt;&amp;quot;&lt;/span&gt;&lt;span style="font-size:11pt;color:maroon;"&gt;&lt;font face="Times New Roman"&gt;AppPoolFor2.0&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;br /&gt;All 5 .Net 1.1 Virtual Directories (Applications) are in &amp;quot;&lt;span style="font-size:11pt;color:maroon;"&gt;&lt;font face="Times New Roman"&gt;AppPoolFor1.1&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&amp;quot; and all the .Net 2.0 Virtual Directories (Applications) are in the &amp;quot;&lt;/span&gt;&lt;span style="font-size:11pt;color:maroon;"&gt;&lt;font face="Times New Roman"&gt;AppPoolFor2.0&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&amp;quot;.&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&amp;nbsp;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" dir="ltr" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:11pt;font-family:Arial;"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;img src="http://dotnetqpearl.net/aggbug.aspx?PostID=45" width="1" height="1"&gt;</content><author><name>securesign</name><uri>http://dotnetqpearl.net/members/securesign.aspx</uri></author><category term="ASP.NET" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/ASP.NET/default.aspx" /><category term="web administrator" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/web+administrator/default.aspx" /><category term="web applications" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/web+applications/default.aspx" /><category term="application pools" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/application+pools/default.aspx" /><category term=".NET" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/.NET/default.aspx" /><category term="Virtual Directory" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/Virtual+Directory/default.aspx" /><category term="more than one version of the framework" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/more+than+one+version+of+the+framework/default.aspx" /><category term="Virtual Directories" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/Virtual+Directories/default.aspx" /><category term="w3wp.exe" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/w3wp.exe/default.aspx" /><category term="Server Application Unavailable" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/Server+Application+Unavailable/default.aspx" /><category term=".NET Framework" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/.NET+Framework/default.aspx" /><category term="Application Pool" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/Application+Pool/default.aspx" /><category term="Worker Possess" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/Worker+Possess/default.aspx" /><category term="Framework Versions" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/Framework+Versions/default.aspx" /><category term="IIS6" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/IIS6/default.aspx" /><category term="Qatar" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/Qatar/default.aspx" /></entry><entry><title>Allow your ASP.NET to Access your Resources</title><link rel="alternate" type="text/html" href="http://dotnetqpearl.net/blogs/securesign/archive/2007/03/19/Allow-your-ASP.NET-to-Access-your-Resources.aspx" /><id>http://dotnetqpearl.net/blogs/securesign/archive/2007/03/19/Allow-your-ASP.NET-to-Access-your-Resources.aspx</id><published>2007-03-19T13:50:00Z</published><updated>2007-03-19T13:50:00Z</updated><content type="html">&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;strong&gt;&lt;span style="font-size:18pt;line-height:115%;font-family:'Arial','sans-serif';"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;As a web administrator; I used to deploy the web applications changes on the production server, two days ago I have stayed about 6 more hours than my normal working day, me and our developers trying to solve a problem that appears when we tried to deploy a new feature in our application that allow the online users to write articles and upload photos on a specific folder on the server.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;The problem starts with this error when we tried to test the application to upload an image file.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;em&gt;&lt;span style="color:red;font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Access to the path &amp;quot;d:\visitorsUpload\Vu01.jpg&amp;quot; is denied&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color:black;font-family:'Arial','sans-serif';"&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size="3"&gt;&lt;strong&gt;Exception Details: &lt;/strong&gt;System.UnauthorizedAccessException: Access to the path &amp;ldquo;d:\visitorsUpload\Vu01.jpg &amp;quot; is denied. &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;I have made sure that all the permissions on this folder are on the right place, ASPNET Account will have read-write permissions and the iuser_machinename will have Read, the virtual directory of that folder will have read. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;(The error is still showing up).&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;We have searched the internet as much as we can to find any solution, but we didn&amp;#39;t find any acceptable one!&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;In that case there must be an account that is responsible for access local and network resources in ASP.NET. What is that account? How it works? How can we know more about it and its useful uses to Access Resources in ASP.NET?&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Let&amp;rsquo;s have a tour together to learn the restrictions imposed by using this account to access resources. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Use this account to access the following resource types: &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt 0.75in;text-indent:-0.25in;line-height:normal;tab-stops:list .75in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;font size="3"&gt;&amp;middot;&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Local file system&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt 0.75in;text-indent:-0.25in;line-height:normal;tab-stops:list .75in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;font size="3"&gt;&amp;middot;&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Windows event log &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt 0.75in;text-indent:-0.25in;line-height:normal;tab-stops:list .75in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;font size="3"&gt;&amp;middot;&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Windows registry &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt 0.75in;text-indent:-0.25in;line-height:normal;tab-stops:list .75in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;font size="3"&gt;&amp;middot;&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Local and remote databases&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt 0.5in;text-indent:-0.25in;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;About Network Service Account&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:green;font-family:Arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:green;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;The Network Service account is a local account used by the service control manager (SCM), this account is not recognized by the security subsystem, so you cannot specify its name in a call to the Lookup Account Name function. It has minimum privileges on the local computer and acts as the computer on the network. The name of the account in all locales is&lt;span style="color:#1f497d;"&gt; NT&lt;/span&gt; &lt;span style="color:#1f497d;"&gt;AUTHORITY\NETWORK SERVICE&lt;/span&gt;. This account does not have a password. If you specify the NetworkService account in a call to the Create Service function, any password information you supply is ignored.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;A service that runs in the context of the NetworkService account presents the computer&amp;#39;s credentials to remote servers. By default, the remote token contains SIDs for the Everyone and Authenticated Users groups.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;By default, Microsoft Internet Information Services (IIS) 6.0 on Windows Server 2003 runs ASP.NET applications in application pools that use the NT AUTHORITY\Network Service account identity. This account is a least privileged machine account with limited permissions. An application that runs using this account has restricted access to the event log, registry, and file system. The account does have network credentials, which means you can use it to access network resources and remote databases by using Windows authentication. The network resources must be in the same domain as your Web server or in a trusted domain.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;&lt;img height="436" src="http://dotnetqpearl.net/photos/web_administration/images/25/original.aspx" width="462" /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;line-height:normal;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;In some scenarios, using a custom domain service account is a better approach than using the Network Service account. You should use a custom domain service account if: &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style="margin-top:0in;"&gt;&lt;li class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;line-height:normal;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;You want to isolate multiple applications on a single server from one another. &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;line-height:normal;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;You need different access controls for each application on local and remote resources. For example, other applications cannot access your application&amp;#39;s databases if access is restricted to your application&amp;#39;s account. &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;line-height:normal;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;You want to use Windows auditing to track the activity of each application separately. &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;line-height:normal;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;You want to prevent any accidental or deliberate changes to the access controls or permissions associated with the general purpose Network Service account from affecting your application. &lt;/font&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;line-height:normal;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;This is how to show you how you can use the Network Service account to access a variety of resources types including the event log, registry, file system, and databases.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="font-size:14pt;line-height:140%;font-family:'Arial','sans-serif';"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:14pt;color:green;font-family:Arial;"&gt;File Access&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:14pt;color:green;font-family:Arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:green;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size:14pt;line-height:140%;font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;line-height:normal;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;The Network Service account has Read and Execute permissions on the IIS server root folder by default. The IIS server root folder is named Wwwroot. This means that an ASP.NET application deployed inside the root folder already has Read and Execute permissions to its application folders. However, if your ASP.NET application needs to use files or folders in other locations, you must specifically enable access. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Granting File Access to Network Service&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;line-height:normal;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;To provide access to an ASP.NET application running as Network Service, you must grant access to the Network Service account. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;To grant read, write, and modify permissions to a specific File or Folder&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;1. In Windows Explorer, locate and select the required file. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;2. Right click the file, and then click &lt;strong&gt;Properties&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;3. In the &lt;strong&gt;Properties&lt;/strong&gt; dialog box, click the &lt;strong&gt;Security&lt;/strong&gt; tab. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;4. On the &lt;strong&gt;Security&lt;/strong&gt; tab, examine the list of users. If the Network Service account is not listed, add it. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;5. In the &lt;strong&gt;Properties&lt;/strong&gt; dialog box, click the &lt;strong&gt;Network Service&lt;/strong&gt; user name, and in the &lt;strong&gt;Permissions for NETWORK SERVICE&lt;/strong&gt; section, select the &lt;strong&gt;Read&lt;/strong&gt;, &lt;strong&gt;Write&lt;/strong&gt;, and &lt;strong&gt;Modify&lt;/strong&gt; permissions. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;6. Click &lt;strong&gt;Apply&lt;/strong&gt;, and then click &lt;strong&gt;OK&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Your ASP.NET application can now write to the specified file.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Note&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;:&amp;nbsp;&amp;nbsp;If you need to allow the same level of access to a file resource for all accounts that run ASP.NET applications (Network Service or a custom service account), you can grant access to the &lt;strong&gt;IIS_WPG &lt;/strong&gt;group instead of specifically to the Network Service account. Any account used to run ASP.NET is required to be a member of the &lt;strong&gt;IIS_WPG&lt;/strong&gt; group.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;font size="3"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;img height="445" src="http://dotnetqpearl.net/photos/web_administration/images/26/original.aspx" width="399" /&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-justify:inter-ideograph;margin:0in 0in 10pt;text-align:justify;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Security Tip:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt; you can restrict access to this account by using NTFS Special permission:&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;1. In Windows Explorer, locate and select the required folder. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;2. Right click the folder, and then click &lt;strong&gt;Properties&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;3. In the &lt;strong&gt;Properties&lt;/strong&gt; dialog box, click the &lt;strong&gt;Security&lt;/strong&gt; tab. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;4. Click advanced button.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;5. Chose the Network service account from the permission entries and click Edit button, this will open the special permission entry for your folder.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;6. Deny &lt;strong&gt;(Delete Subfolders and Files, Delete&lt;/strong&gt;), Uncheck &lt;strong&gt;(Full Control, Traverse Folder/Execute File, Read Permissions, Change Permissions, Take Ownership)&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;7. Click &lt;strong&gt;Apply&lt;/strong&gt;, and then click &lt;strong&gt;OK&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;img height="466" src="http://dotnetqpearl.net/photos/web_administration/images/27/original.aspx" width="364" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Your ASP.NET application can now write to the specified Folder but with the most restrictive permission.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="font-size:14pt;line-height:140%;font-family:'Arial','sans-serif';"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:14pt;color:green;font-family:Arial;"&gt;Event Log Access&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:14pt;color:green;font-family:Arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:green;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Applications that run using the Network Service identity can write to the event log by using existing event sources, but they cannot create new event sources because of insufficient registry permissions. When you use the &lt;strong&gt;EventLog.Write&lt;/strong&gt; method, if the specified event source does not exist, this method attempts to create the event source and a security exception is generated.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 5pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Note&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;It is useful to use application specific event sources so that your applications&amp;#39; events can easily be differentiated from other applications&amp;#39; events.&lt;strong&gt; &lt;/strong&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;To enable your ASP.NET application to write to the event log using an event source that does not already exist, you have two options: &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 22.5pt 3.75pt 48pt;vertical-align:top;text-indent:-0.25in;line-height:140%;tab-stops:list 48.0pt;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;font size="3"&gt;&amp;middot;&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Create new event sources at application install time. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 22.5pt 3.75pt 48pt;vertical-align:top;text-indent:-0.25in;line-height:140%;tab-stops:list 48.0pt;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;font size="3"&gt;&amp;middot;&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Manually create new event source entry in the registry. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Create a New Event Source at Install Time&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;With this option, you create a specialized installer class that you run by using the install utility to create a new event source at install time when administrator privileges are available. You run the install utility using an administrator account so it has permission to create the new event source.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;To create an installer class to create event sources&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;1. Use Visual Studio .NET 2005 to create a class library project named InstallerClass.dll. Add a reference of System.Configuration.Install to the InstallerClass project. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;2. Name the class &lt;strong&gt;CustomEventLogInstaller&lt;/strong&gt;, and derive it from &lt;strong&gt;System.Configuration.Install.Installer&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;3. Set the &lt;strong&gt;RunInstaller &lt;/strong&gt;attribute for the class to &lt;strong&gt;true&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;4. Create a &lt;strong&gt;System.Diagnostics.EventLogInstaller&lt;/strong&gt; instance for each new event log your application needs, and call &lt;strong&gt;Installers.Add&lt;/strong&gt; to add the instance to your project installer class. The following sample class adds one new event source named customLog to the Application Event Log. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="background:#dddddd;margin:0in 22.5pt 10pt 45pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;using System;&lt;br /&gt;using System.Configuration.Install;&lt;br /&gt;using System.Diagnostics;&lt;br /&gt;using System.ComponentModel;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;[RunInstaller(true)]&lt;br /&gt;public class CustomEventLogInstaller: Installer&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; private EventLogInstaller customEventLogInstaller;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public CustomEventLogInstaller() &lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create an instance of &amp;#39;EventLogInstaller&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; customEventLogInstaller = new EventLogInstaller();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the &amp;#39;Source&amp;#39; of the event log, to be created.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; customEventLogInstaller.Source = &amp;quot;customLog&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the &amp;#39;Event Log&amp;#39; that the source is created in.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; customEventLogInstaller.Log = &amp;quot;Application&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Add myEventLogInstaller to &amp;#39;InstallerCollection&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Installers.Add(customEventLogInstaller);&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp; public static void Main()&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;5. Compile the code for the InstallerClass.dll library. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;6. Use an account with administrative privileges to run the InstallUtil.exe utility, supplying the name of the DLL on the command line. For example, open the Visual Studio command prompt and enter the following command. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="background:#dddddd;margin:0in 22.5pt 10pt 45pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;InstallUtil.exe &amp;lt;dll path&amp;gt;\InstallerClass.dll &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;When the install utility is called with the installer class, it examines the &lt;strong&gt;RunInstallerAttribute&lt;/strong&gt;. If this is &lt;strong&gt;true&lt;/strong&gt;, the utility installs all the items in the &lt;strong&gt;Installers&lt;/strong&gt; collection. This creates the specified event sources for your ASP.NET application.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Manually Create New Event Source Entry in the Registry&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;If you are unable to create an event source at installation time, and you are in deployment, the administrator should manually create a new event source entry beneath the following registry key&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="background:#dddddd;margin:0in 22.5pt 10pt 0in;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\&amp;lt;LogName&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;To manually create a new event source entry beneath this registry key&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;1. Start the Registry Editor tool Regedit.exe. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;2. Using the Application Event log, expand the outline list in the left panel to locate the following registry subkey: &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt 45pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;3. Right-click the &lt;strong&gt;Application&lt;/strong&gt; subkey, point to &lt;strong&gt;New&lt;/strong&gt;, and then click &lt;strong&gt;Key&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;4. Type a new event source name for the key name and press &lt;strong&gt;Enter&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;The Network Service account can use the new event source for writing events. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 5pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Note&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;You should not grant write permission to the ASP.NET process account (or any impersonated account if your application uses impersonation) on the &lt;strong&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\ &lt;/strong&gt;registry key. If you allow write access to this key and the account is compromised, the attacker can modify any log-related setting, including access control to the log, for any log on the system.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Health Monitoring&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;ASP.NET version 2.0 health monitoring writes to the Windows application event log to report significant lifetime and security events, if configured to do so. You can raise custom events in your code to write to the event log by using ASP.NET health monitoring. This approach does not use &lt;strong&gt;EventLog.WriteEntry&lt;/strong&gt;, but you are restricted to use a predefined event source. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="font-size:14pt;line-height:140%;font-family:'Arial','sans-serif';"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:14pt;color:green;font-family:Arial;"&gt;Registry Access&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:14pt;color:green;font-family:Arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:green;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;The Network Service account does not have Write access to the registry. If your application needs to write to the registry, you must configure the necessary access control lists (ACLs) on the required registry keys.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Granting Registry Access to Network Service&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;In the following example, an application needs to change and display the name of the Internet time server that Windows is automatically synchronized with. An operator can change this setting by using the &lt;strong&gt;Internet&lt;/strong&gt; &lt;strong&gt;Time&lt;/strong&gt; tab from the Date and Time item in the Control Panel. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Your application needs to modify the following registry key:&lt;/font&gt;&lt;font size="3"&gt;&lt;strong&gt; &lt;br /&gt;HKLM\SOFTWARE\ Microsoft\Windows\CurrentVersion\DateTime\Servers&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;To allow the Network Service Account Write Access to the preceding registry key&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;You need to use an administrator account with permission to alter the registry security to perform the following steps: &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;1. On the taskbar, click &lt;strong&gt;Start&lt;/strong&gt;, and then click &lt;strong&gt;Run&lt;/strong&gt;. Type &lt;strong&gt;regedit&lt;/strong&gt; in the &lt;strong&gt;Open&lt;/strong&gt; box, and then click &lt;strong&gt;OK&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;2. Expand the outline list in the left panel to locate the DateTime folder icon at the preceding registry path. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;3. Right-click the DateTime folder, and then click &lt;strong&gt;Permissions&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;4. In the &lt;strong&gt;Permission for Servers&lt;/strong&gt; dialog box, click the &lt;strong&gt;Add&lt;/strong&gt; button. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;5. In the &lt;strong&gt;Select Users, Computers, or Groups&lt;/strong&gt; dialog box, type &lt;strong&gt;NETWORK SERVICE&lt;/strong&gt; in the text box, and then click &lt;strong&gt;Check Names&lt;/strong&gt;. The Network Service name will be underlined; this indicates that it is a valid security principal. Click &lt;strong&gt;OK&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;6. In the &lt;strong&gt;Permissions for Servers&lt;/strong&gt; dialog box, click the &lt;strong&gt;Network Service&lt;/strong&gt; user name from the list, and in the &lt;strong&gt;Permissions for NETWORK SERVICE&lt;/strong&gt; section, click &lt;strong&gt;Advanced&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;7. In the Advanced Security Settings for Servers dialog box, click Network Service, and then click Edit. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;8. In the &lt;strong&gt;Permission Entry for Servers&lt;/strong&gt; dialog box, select the &lt;strong&gt;Set Value&lt;/strong&gt; and &lt;strong&gt;Create&lt;/strong&gt; &lt;strong&gt;Subkey&lt;/strong&gt; check boxes in the &lt;strong&gt;Allow&lt;/strong&gt; column to permit write access. Click &lt;strong&gt;OK&lt;/strong&gt; several times until the &lt;strong&gt;Permissions &lt;/strong&gt;dialog box closes. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 5pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Note&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;You should be careful while editing the registry because any mistake can lead to system instability.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Your ASP.NET application could now use code similar to the following sample to change and display the name of the Internet time server.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="background:#dddddd;margin:0in 22.5pt 10pt 0in;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;using Microsoft.Win32;&lt;br /&gt;...&lt;br /&gt;protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; //change the time server&lt;br /&gt;&amp;nbsp; RegistryKey rk = Registry.LocalMachine.OpenSubKey(&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;quot;SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers&amp;quot;, &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; true); //writable - this will fail without proper access&lt;br /&gt;&amp;nbsp; string sDefault = (String)rk.GetValue(&amp;quot;&amp;quot;);&lt;br /&gt;&amp;nbsp; int iDefault = Convert.ToInt32(sDefault);&lt;br /&gt;&amp;nbsp; //this an array of all the server names&lt;br /&gt;&amp;nbsp; string[] sServers = rk.GetValueNames(); //requires enumerate sub keys&lt;br /&gt;&amp;nbsp; iDefault++;&lt;br /&gt;&amp;nbsp; if (iDefault &amp;gt;= sServers.Length) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iDefault=1;&lt;br /&gt;&amp;nbsp; rk.SetValue(&amp;quot;&amp;quot;, iDefault.ToString());&lt;br /&gt;&amp;nbsp; // update display&lt;br /&gt;&amp;nbsp; Response.write(rk.GetValue(sServers[iDefault]).ToString());&lt;br /&gt;}&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="font-size:14pt;line-height:140%;font-family:'Arial','sans-serif';"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:14pt;color:green;font-family:Arial;"&gt;SQL Server&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;direction:ltr;unicode-bidi:embed;text-align:left;"&gt;&lt;strong&gt;&lt;span style="font-size:14pt;color:green;font-family:Arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:green;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;ASP.NET applications should use Windows authentication while connecting to a database. By using Windows authentication, you avoid storing database credentials in connection strings and you avoid passing passwords over the network to the database server. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;With Windows authentication, your application&amp;#39;s process account is used by default for authentication. To be able to access a database, your account requires: &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 22.5pt 3.75pt 48pt;vertical-align:top;text-indent:-0.25in;line-height:140%;tab-stops:list 48.0pt;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;font size="3"&gt;&amp;middot;&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;A SQL Server login on the database server. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 22.5pt 3.75pt 48pt;vertical-align:top;text-indent:-0.25in;line-height:140%;tab-stops:list 48.0pt;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;font size="3"&gt;&amp;middot;&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;Permissions to the required objects (for example, stored procedures, views, or tables) in the required database. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Granting Access to a Local SQL Server&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;When the SQL Server is on the Web server, you must create a database login for the NT AUTHORITY\Network Service account. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;To access a local SQL Server database using Network Service&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;1. Start SQL Server Enterprise Manager. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;2. Expand the folders in the left panel and locate the &lt;strong&gt;Security&lt;/strong&gt; folder for your local SQL Server. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;3. Right-click &lt;strong&gt;Logins&lt;/strong&gt; in the &lt;strong&gt;Security&lt;/strong&gt; folder, and then click &lt;strong&gt;New Login&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;4. In the &lt;strong&gt;SQL Server Login Properties - New Login&lt;/strong&gt; dialog box, in the &lt;strong&gt;Name&lt;/strong&gt; box, enter &lt;strong&gt;NT AUTHORITY\NETWORK SERVICE&lt;/strong&gt;. Accept the defaults for the other settings, and then click &lt;strong&gt;OK&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;5. Expand the Databases folders, and then expand the Pubs (or equivalent) database. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;6. Right-click &lt;strong&gt;Users&lt;/strong&gt;, and then click &lt;strong&gt;New Database User&lt;/strong&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;7. In the &lt;strong&gt;Database User Properties - New User&lt;/strong&gt; dialog box, select the NT&amp;nbsp;AUTHORITY\NETWORK&amp;nbsp;SERVICE account. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;8. In the &lt;strong&gt;Permit in Database Role&lt;/strong&gt; list, select the &lt;strong&gt;db_datareader&lt;/strong&gt; check box. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 3.75pt 45pt;vertical-align:top;text-indent:-0.25in;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;9. Click &lt;strong&gt;OK&lt;/strong&gt;, and then close the SQL Server Enterprise Manager. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;The Network Service account now has permission to read the data in the tables of the designated database. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;In practice, your application&amp;#39;s requirements may be more complex. For example, you might want to allow read access to certain tables and allow update access to others. The recommended approach to help mitigate the risk posed by SQL injection is to grant execute permissions to the Network Service account on a selected set of stored procedures and provide no direct table access.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Granting Access to a Remote SQL Server&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;If you are accessing a database on another server in the same domain (or in a trusted domain), the Network Service account&amp;#39;s network credentials are used to authenticate to the database. The Network Service account&amp;#39;s credentials are of the form &lt;strong&gt;&lt;em&gt;DomainName&lt;/em&gt;\&lt;em&gt;AspNetServer&lt;/em&gt;$&lt;/strong&gt;, where &lt;strong&gt;&lt;em&gt;DomainName&lt;/em&gt;&lt;/strong&gt; is the domain of the ASP.NET server and &lt;strong&gt;&lt;em&gt;AspNetServer&lt;/em&gt;&lt;/strong&gt; is your Web server name.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;For example, if your ASP.NET application runs on a server named SVR1 in the domain CONTOSO, the SQL Server sees a database access request from CONTOSO\SVR1$.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;To access a remote SQL Server using Network Service&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 7.5pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&lt;font size="3"&gt;To grant access to a remote database server in the same domain or a trusted domain, follow the steps described earlier for a local database, except in step 4, use the &lt;strong&gt;DomainName\AspNetServer$&lt;/strong&gt; account to create the database login.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;Note&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:'Arial','sans-serif';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;In production environments, you should place the network service account into a Windows group and create a SQL Server login for the Windows group.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt 0.5in;text-indent:-0.25in;"&gt;&lt;font face="Calibri" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://dotnetqpearl.net/aggbug.aspx?PostID=21" width="1" height="1"&gt;</content><author><name>securesign</name><uri>http://dotnetqpearl.net/members/securesign.aspx</uri></author><category term="ASP.NET" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/ASP.NET/default.aspx" /><category term="web administrator" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/web+administrator/default.aspx" /><category term="System.UnauthorizedAccessException" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/System.UnauthorizedAccessException/default.aspx" /><category term="event log" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/event+log/default.aspx" /><category term="registry" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/registry/default.aspx" /><category term="application pools" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/application+pools/default.aspx" /><category term=".NET" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/.NET/default.aspx" /><category term="Network Service" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/Network+Service/default.aspx" /><category term="SQL Server" scheme="http://dotnetqpearl.net/blogs/securesign/archive/tags/SQL+Server/default.aspx" /></entry></feed>