<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>HTTPContext</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/httpcontext/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/httpcontext/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:23:34 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to check which permission your assembly requires using Permcalc.exe</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/how-to-check-which-permission-your-assembly-requires-using-permcalc-exe</link>
      <pubDate>Fri, 15 Nov 2013 08:50:11 GMT</pubDate>
      <dc:creator><![CDATA[Rezwan Rahman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2013/11/15/how-to-check-which-permission-your-assembly-requires-using-permcalc-exe/</guid>
      <description><![CDATA[I was working on a case recently where the customer was a hosting service provider and his client's...]]></description>
      <content:encoded><![CDATA[<p>I was working on a case recently where the customer was a hosting service provider and his client's hosted application was showing a server error. Specifically the error was thrown due to a security exception.</p>
<p>Security Exception <br />Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.</p>
<p>The customer was using a custom-medium trust security policy which is common across all applications hosted. Therefore we needed to work out which permissions the client's application required on the system. This was achieved in the following way:</p>
<p>1. Copied over&nbsp;the BIN directory with custom assemblies to a windows 2008 R2 server.</p>
<p>2. Downloaded the .NET framework 2.0 SDK from here: <a href="https://www.microsoft.com/en-us/download/details.aspx?id=19988">https://www.microsoft.com/en-us/download/details.aspx?id=19988</a></p>
<p>3. Ran the SDK command prompt and ran permcalc.exe with the following command: permcalc &ndash; show &lt;assembly&gt; &lt;assembly&gt; etc (you can add more assemblies with a space)</p>
<p>4. This generates an xml file with the required permissions the assemblies require.</p>
<p>The following is sample output from this command.</p>
<p>&lt;?xml version="1.0" ?&gt;</p>
<p>&lt;Assembly&gt;</p>
<p>&lt;Namespace Name="ClassLibrary1"&gt;</p>
<p>&lt;Type Name="Class1"&gt;</p>
<p>&lt;Method Sig="instance void test()" /&gt;</p>
<p>&lt;Method Sig="instance void .ctor()"&gt;</p>
<p>&lt;Demand&gt;</p>
<p>&lt;PermissionSet version="1"</p>
<p>class="System.Security.PermissionSet"&gt;</p>
<p>&lt;IPermission version="1"</p>
<p>class="System.Security.Permissions.RegistryPermission,<br />mscorlib,</p>
<p>Version=2.0.0.0, Culture=neutral,<br />PublicKeyToken=b77a5c561934e089"</p>
<p>Read="true" /&gt;</p>
<p>&lt;IPermission version="1" class="System.Security.Permissions.FileIOPermission,<br />mscorlib,</p>
<p class="MsoNormal">Version=2.0.0.0, Culture=neutral,<br />PublicKeyToken=b77a5c561934e089"</p>
<p>Unrestricted="true" /&gt;</p>
<p>&lt;/PermissionSet&gt;</p>
<p>&lt;/Demand&gt;</p>
<p>&lt;Sandbox&gt;</p>
<p>&lt;PermissionSet version="1"<br />class="System.Security.PermissionSet"&gt;</p>
<p>&lt;IPermission version="1"<br />class="System.Security.Permissions.RegistryPermission, mscorlib,</p>
<p>Version=2.0.0.0, Culture=neutral,<br />PublicKeyToken=b77a5c561934e089"</p>
<p>Read="true" /&gt;</p>
<p>&lt;IPermission version="1"<br />class="System.Security.Permissions.FileIOPermission, mscorlib,</p>
<p>Version=2.0.0.0, Culture=neutral,<br />PublicKeyToken=b77a5c561934e089"</p>
<p>Unrestricted="true" /&gt;</p>
<p>&lt;/PermissionSet&gt;</p>
<p>&lt;/Sandbox&gt;</p>
<p>&lt;/Method&gt;</p>
<p>&lt;/Type&gt;</p>
<p>&lt;/Namespace&gt;</p>
<p>&lt;/Assembly&gt;</p>
<p>Examine the permissions listed in the &lt;Demand&gt; element. These represent the permissions that the assembly needs. In this case, the assembly needs RegistryPermission and FileIOPermission.</p>
<p>&lt;IPermission version="1"<br />class="System.Security.Permissions.RegistryPermission, mscorlib,<br />Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Read="true"<br />/&gt;</p>
<p>&lt;IPermission version="1"</p>
<p>class="System.Security.Permissions.FileIOPermission,<br />mscorlib,</p>
<p>Version=2.0.0.0, Culture=neutral,<br />PublicKeyToken=b77a5c561934e089"</p>
<p>Unrestricted="true" /&gt;</p>
<p>&nbsp;5. Add the missing permissions into the policy file and the exception should go away :)</p>
<p>&nbsp;</p>
<p>Hope that helps.</p>
<p>&nbsp;</p>
<p>Rez</p>]]></content:encoded>
    </item>
    <item>
      <title>Sample test .aspx page to display User Security Principal and Name</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/sample-test-aspx-page-to-display-user-security-principal-and-name</link>
      <pubDate>Thu, 05 Sep 2013 07:15:00 GMT</pubDate>
      <dc:creator><![CDATA[Rezwan Rahman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2013/09/05/sample-test-aspx-page-to-display-user-security-principal-and-name/</guid>
      <description><![CDATA[Hi Folks,
For a case recently I was required to provide a quick sample script to display the logged...]]></description>
      <content:encoded><![CDATA[<p>Hi Folks,</p>
<p>For a case recently I was required to provide a quick sample script to display the logged in user security principal which I have attached to this post. I hope you will also find it useful.</p>
<p>My colleagues from the French team has also posted a similar post on this: <span style="color: #1f497d; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-GB; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><a href="https://blogs.msdn.com/b/friis/archive/2013/01/08/asp-net-authentication-test-page.aspx">https://blogs.msdn.com/b/friis/archive/2013/01/08/asp-net-authentication-test-page.aspx</a></span></p>
<p>Thanks,</p>
<p>Rez</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/44/66/62/UserID.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-44-66-62/UserID.zip">UserID.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Custom Error pages in IIS 7/7.5</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/custom-error-pages-in-iis-77-5</link>
      <pubDate>Mon, 04 Feb 2013 07:54:00 GMT</pubDate>
      <dc:creator><![CDATA[Rezwan Rahman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2013/02/04/custom-error-pages-in-iis-77-5/</guid>
      <description><![CDATA[Today I thought I would walk through how to enable custom error pages in IIS 7/7.5. Custom error...]]></description>
      <content:encoded><![CDATA[<p>Today I thought I would walk through how to enable custom error pages in IIS 7/7.5. Custom error pages allow you to specify the content that you want to display to users when a specific HTTP error code is received. Its a powerful technique empowering users to be aware of what has happened that caused their request to fail.</p>
<p>It is now easier than ever to have your own custom error pages that can be reported back to all users or just clients and here are some simple steps on how you can achieve this.</p>
<p>&nbsp;</p>
<p>Note: Our focus is on enabling custom error pages at the site level only. You can use this concept to apply the error pages to all sites if you wish.</p>
<p>1. Open the IIS MMC &gt; In the Features view select Error pages&nbsp;</p>
<p>2. Click on the Edit Feature settings in the right pane&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/1307.edit%20error%20pages.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/1307.edit-error-pages.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/1307.edit%20error%20pages.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/1307.edit-error-pages.png" alt="" width="320" height="313" border="0" /></a></p>
<p><strong>As you can see there are three choices here for error responses. "Custom error pages" - specifies that all requests (local or remote) are sent custom error pages. "Detailed errors" - specifies that all requests receive the&nbsp;default HTTP error pages. "Detailed errors for local requests and custom error pages for remote requests" - specifies that local requests are sent detailed error pages and remote requests are sent the custom error pages.</strong></p>
<p>3. For the purposes of this walkthrough, I will select the last option as we want&nbsp;requests made on the server&nbsp;to receive detailed pages explaining the exact issue for troubleshooting. Leave the rest as default. &gt; OK</p>
<p>4. In the right pane select Add and type in a custom status code. Remember that you cannot&nbsp;overwrite an existing one&nbsp;so you must delete it and then create a new one. We will create two, HTTP 401.1 - user access denied and HTTP 401.2 - denied by server configuration.</p>
<p>5. You can place the error pages within a physical directory located in your web content directory. In this example I have created a folder called custerr located in c:\inetpub\wwwroot with two custom error pages 401.1 and 401.2. The file path field&nbsp;takes a relative path as its value.</p>
<p><strong><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/3250.edit%20error%20pages%202.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/3250.edit-error-pages-2.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/3250.edit%20error%20pages%202.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/3250.edit-error-pages-2.png" alt="" width="337" height="350" border="0" /></a></strong></p>
<p><strong>The "Execute a URL on this site" option allows you to specify a URL instead of a file path to your error page. This way the error page is displayed physically in the URL with the appropriate name in the address bar.</strong></p>
<p><strong>The "Respond with a 302 redirect" options redirects users to an absolute URL.</strong></p>
<p>6. You should now see your custom error pages in the features view. Note: you can determine if the error page is specified at the root level or at the site/virtual dir&nbsp;level simply by viewing the "entry type" column. If its set to local then its set at the site/virtual dir&nbsp;level only otherwise it will be an&nbsp;inherited type.</p>
<p>7. Now open a browser window and browse to a site with&nbsp;Windows Integrated Authentication&nbsp;enabled. Enter a bad username/password combination and you should then see your&nbsp;detailed error page display on the server. Now test from a remote machine and you should see your custom error page.</p>
<p>See simple!</p>
<p>So where&nbsp;is this information stored?</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/1754.webconfig.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/1754.webconfig.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/1754.webconfig.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/1754.webconfig.png" alt="" width="624" height="74" border="0" /></a>&nbsp;</p>
<p>Its all in the web.config file. So here you can manually edit and remove as and when necessary. One thing to note, if you remove the default HTTP error page references from the config file, you can simple start again by removing these custom HTTP error references to restore it back to the default.</p>
<p>&nbsp;</p>
<p>So to summarise:</p>
<p>&nbsp;</p>
<p>1. Opened IIS MMC and navigated to the website.</p>
<p>2. Clicked Error pages and selected the edit feature.</p>
<p>3. Selected display custom error pages and detailed pages.</p>
<p>4. Specified a relative path to the custom error pages which<br />were located in the root of the website content.</p>
<p>5. Browsed the site and made sure we get a prompt for<br />credentials, we did and we saw our custom error page when the correct<br />credentials were not entered.</p>
<p>&nbsp;</p>
<p>Hope that helps.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong></strong>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Cannot read configuration file because it exceeds the maximum file size (web.config)</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/cannot-read-configuration-file-because-it-exceeds-the-maximum-file-size-web-config</link>
      <pubDate>Tue, 23 Oct 2012 03:17:00 GMT</pubDate>
      <dc:creator><![CDATA[Rezwan R]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2012/10/23/cannot-read-configuration-file-because-it-exceeds-the-maximum-file-size-web-config/</guid>
      <description><![CDATA[I recently came across an interesting case, where the customer was in the process of migrating their...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">I recently came across an interesting case, where the customer was in the process of migrating their content over to a new build of IIS 7.5. All was going well till they hit an issue when migrating their 1MB web.config file, where they received an error "cannot read configuration file because it exceeds the maximum file size". The customer asked why they were receiving the error and why is there a limit imposed? Here is how I responded:</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">We have found an internal article that mentions that the reason for the 250KB limit is to reduce the chances of an attacker uploading a large web.config file. This is not just for migration of websites but also when deploying such large web.config files into existing website builds.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">The upper value of this limit can be changed by modifying the&nbsp;following registry key:</span></p>
<div class="reg_path"><samp>HKLM\SOFTWARE\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB&nbsp; (REG_DWORD)</samp></div>
<p><strong>Note </strong>If you configure IIS 7.0 and IIS 7.5 to run in 32-bit mode on Windows Server 2008 x64 or on Windows Server 2008 R2 x 64, the registry key is instead the following:</p>
<div class="indent">
<div class="reg_path"><samp>HKLM\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB (REG_DWORD)</samp></div>
<div class="reg_path"><samp></samp>&nbsp;</div>
<div class="reg_path"><samp><a href="https://support.microsoft.com/kb/954864">https://support.microsoft.com/kb/954864</a></samp></div>
<div class="reg_path"><samp></samp>&nbsp;</div>
</div>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">The alternative to changing the default value is to split up the web.config files in to separate files. The benefits of this are, reduced chances of denial of service attacks, by specifying authorization rules to determine who can edit it whilst still keeping the default 250KB value. Also it allows better manageability of the files and reduces the impact&nbsp;of human error.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">More information on how to do this can be found here:</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;"><a href="https://www.iis.net/learn/get-started/planning-your-iis-architecture/getting-started-with-configuration-in-iis-7-and-above">https://www.iis.net/learn/get-started/planning-your-iis-architecture/getting-started-with-configuration-in-iis-7-and-above</a></span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;"><a href="https://netrsc.blogspot.co.uk/2006/05/how-to-split-webconfig-sections-into.html">https://netrsc.blogspot.co.uk/2006/05/how-to-split-webconfig-sections-into.html</a></span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;"><a href="https://www.davidturvey.com/blog/index.php/2009/10/how-to-split-the-web-config-into-mutliple-files/">https://www.davidturvey.com/blog/index.php/2009/10/how-to-split-the-web-config-into-mutliple-files/</a></span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">Note: <strong><em>Make sure you use .config as the extension of your files so they cannot be served to the browser.</em></strong></span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;"><a href="https://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.configsource.aspx">https://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.configsource.aspx</a></span></p>
<p>&nbsp;HTH</p>
<p>&nbsp;</p>
<p>Rezwan Rahman</p>]]></content:encoded>
    </item>
    <item>
      <title>Shared Session State in a IIS6 and IIS7 Web Farm</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/shared-session-state-in-a-iis6-and-iis7-web-farm</link>
      <pubDate>Fri, 22 Jun 2012 07:12:48 GMT</pubDate>
      <dc:creator><![CDATA[Alex Olivier]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2012/06/22/shared-session-state-in-a-iis6-and-iis7-web-farm/</guid>
      <description><![CDATA[It is not an uncommon scenario to have a web farm of servers sitting behind a load balancer. In...]]></description>
      <content:encoded><![CDATA[<div>
<p>It is not an uncommon scenario to have a web farm of servers sitting behind a load balancer. In fact that is the only way you can achieve high availability so it is recommended.One issue that arises when this setup is used is when the user session needs to be persisted across all the servers.&nbsp; For example, a request comes in through the load balancer to MachineA. IIS runs the site, a session is created, information is stored in it and the site is appearing functional. Now imagine if something happened to MachineA to take it offline, the load balancer would take it out of rotation and the next request would go to a different machine, which has no knowledge of the previous session and so it would appear to the user as if the site had reset itself or something had gone <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/0167.Diag.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/0167.Diag.jpg"><img width="159" height="249" style="float: right;" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/0167.Diag.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/0167.Diag.jpg" border="0" /></a>wrong.</p>
</div>
<p>There are many well documented ways to setup shared session state, either using a session state server or a SQL server, but there is one situation where you can run into issues with the session being unreadable by all machines. This can occur when your server farm consists of a mix of IIS6 and IIS7/7.5 machines.</p>
<p>Consider the architecture in the diagram. A request could come in, be served by the first IIS6 box which would create the session and store onto the state server. The next request from the same user could be routed to an IIS7 box, and in this case there is a chance that IIS7 cannot decrypt the session, and you would end up with an error presented to the user.<br />This is down to the encryption key, decryption key and the encryption method that is set on each server in the machine.config. These need to be the same in order for every server to be read the session.</p>
<p>Also, if you web farm is hosting multiple sites in IIS, there is one more setting that you need to be aware of. In most cases, if you have one website, it will have an application ID of 1 inside IIS, but as you add more sites, the application ID will be mismatched across servers.</p>
<p>The session ID that is used in the session state server is actually a hash of the application id and the user session ID, so if your applications do not have the same application ID inside your IIS instances on all servers, when another server looks up the session, it will fail as it is looking for a session but created with a different ApplicationID.</p>
<p><b><span style="text-decoration: underline;">Setting ApplicationID in IIS7+</span></b></p>
<p>To set this in IIS7+, it is very easy. Simply open IIS Manger, and then drill down into your site, and the in the Action Pane, open the &ldquo;Advanced Settings&rdquo;. Inside there, there is an ID field. Set this to the same on every server for each site.</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/8883.iis7.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/8883.iis7.jpg"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/8883.iis7.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/8883.iis7.jpg" border="0" /></a>&nbsp;</p>
<p><b><span style="text-decoration: underline;">Setting ApplicationID in IIS6</span></b></p>
<p>The simplest way of doing this is to use the admin scripts:</p>
<ol>
<li>Open an elevated&nbsp;command line</li>
<li>Navigate to your AdminScripts directory (be default in c:\Inetpub\AdminScripts).</li>
<li>And run this script:</li>
</ol>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cscript adsutil.vbs move w3svc/999 w3svc/2</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Where the first is the old Site ID and the second is the new one)</p>
<p>The other manual way is to edit the MetaBase.xml, and update the IDs. If you don&rsquo;t get them all right, the IIS server won&rsquo;t start, so take care when doing this.</p>
<p>&nbsp;</p>
<p>Once all the site ID's and the machine keys are the same, then all your sessions should be available to all systems, irrelevant of OS, IIS version or State Management system.</p>
<p>Hope it helps!</p>
<p>Alex Olivier</p>]]></content:encoded>
    </item>
    <item>
      <title>Using Web Farm Framework behind a Proxy</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/using-web-farm-framework-behind-a-proxy</link>
      <pubDate>Wed, 13 Jun 2012 07:22:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Olivier]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2012/06/13/using-web-farm-framework-behind-a-proxy/</guid>
      <description><![CDATA[We have seen quite a few instances where users are setting up a web farm using Web Farm Framework...]]></description>
      <content:encoded><![CDATA[<p>We have seen quite a few instances where users are setting up a web farm using <a href="https://www.iis.net/download/webfarmframework">Web Farm Framework</a> (WFF) behind a proxy. As WFF relies on getting the products from the internet through <a href="https://www.microsoft.com/web/downloads/platform.aspx">Web Platform Installer</a>, and&nbsp;provisioning will fail if it can't reach the outside world, so your proxy settings need to be passed to the server.&nbsp;One thing to note is that as WFF runs on a server as a local account, any proxy settings coming down from your AD will not be used by the Web Platform Installer. If you see the following in your error log, it is a tell tail sign that the content servers can't reach the internet.</p>
<p align="left"><span style="font-family: courier new,courier; font-size: small;">2011-11-07T15:16:28.8528558+00:00 Error Primary &amp; Farm Server1 Failed to run operation &lsquo;RunRemote&rsquo;.&nbsp; Failed to run method &lsquo;Microsoft.Web.Farm.GetInstalledProductsRemoteMethod&rsquo; on server &lsquo;Server1&prime;.&nbsp; Exception in response stream.&nbsp; InternetOpenUrl returned 0x80072EFD: Unknown error 12029.&nbsp; Exception in response stream.&nbsp; InternetOpenUrl returned 0x80072EFD: Unknown error 12029. Microsoft.Web.Farm.WebFarmException: Failed to run method &lsquo;Microsoft.Web.Farm.GetInstalledProductsRemoteMethod&rsquo; on server &lsquo;Server1&prime;.&nbsp; Exception in response stream.&nbsp; InternetOpenUrl returned 0x80072EFD: Unknown error 12029. &mdash;&gt; Microsoft.Web.Farm.WebFarmException: Exception in response stream &mdash;&gt; System.Net.WebException: InternetOpenUrl returned 0x80072EFD: Unknown error 12029.</span></p>
<p>In WFF 2.2, you can set a proxy server that all your servers will use in your applicationHost.config. This setting will be passed to all your servers for their calls out to the Web Products Feed xml file used by Web Platform Installer. You can set this using the following appcmd:</p>
<p align="left"><span style="font-family: courier new,courier; font-size: small;">appcmd.exe set config -section:webFarms /[name='Primary'].defaultProxy.enabled:"True" /[name='Primary'].defaultProxy.proxyaddress:"proxyservername:80" /[name='Primary'].defaultProxy.userName:"testuser" /[name='Primary'].defaultProxy.password:"Password1" /commit:apphost</span></p>
<p>You will need to replace the name of your webfarm where it says &lsquo;Primary&rsquo; and put your proxy details where it says &ldquo;proxyservername:80&Prime;. If you proxy requires authentication, replace &ldquo;testuser&rdquo; and &ldquo;Password1&Prime; with the username and password respectively.</p>
<p>The same settings in the applicationHost.config XML format is as&nbsp;follows and needs to be inside the WebFarm node:&nbsp;</p>
<p><span style="font-family: courier new,courier; font-size: small;">&lt;defaultProxy enabled="true" proxyaddress="proxyservername:80" userName="testuser" password="Password1" /&gt;</span><span style="font-family: courier new,courier; font-size: small;"></span></p>
<p>Web Farm Framework is a very powerful system for managing your content servers, and using it behind a proxy is a very common scenario, so hopefully this will help you when configuring and troubleshooting internet connectivity issues.</p>
<p>Hope it helps!</p>
<p>&nbsp;</p>
<p>Alex Olivier</p>]]></content:encoded>
    </item>
    <item>
      <title>Configure IIS FTP User Isolation using an IIS Managed User Account</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/configure-iis-ftp-user-isolation-using-an-iis-managed-user-account</link>
      <pubDate>Wed, 06 Jun 2012 04:09:00 GMT</pubDate>
      <dc:creator><![CDATA[Rezwan Rahman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2012/06/06/configure-iis-ftp-user-isolation-using-an-iis-managed-user-account/</guid>
      <description><![CDATA[FTP 7.5 has a feature that allows you to create a managed user account without requiring you to add...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;"><span style="font-family: Calibri;">FTP 7.5 has a feature that allows you to create a managed user account without requiring you to add a domain user. This user can be used as part of FTP access and also allow user isolation among directories.</span></span><span style="font-size: small;"><span style="font-family: Calibri;">The purpose of this blog is to show you the steps of how to achieve this with a test user account and test certificate.</span></span></p>
<p>&nbsp;</p>
<p><span style="font-size: medium;"><strong><span><span style="font-family: Calibri;"><span style="text-decoration: underline;">Creating a brand new FTP site</span></span></span></strong></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">1.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Open the IIS Manager &gt; Right click the Websites root &gt; Add ftp site </span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">2.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">In the &ldquo;Add FTP site&rdquo; dialog box enter the FTP Site name and the physical path of the directory. In this example we will call the site &ldquo;FTP&rdquo; and the physical path will point to C:\Inetpub\Ftproot (not very creative </span>J<span style="font-family: Calibri;">) &gt; Next</span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">3.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">In the next screen assign a static IP address, port number and a Virtual host name depending on preference.&nbsp; In this case we will leave the default settings and select &ldquo;Allow SSL&rdquo;. </span></span><span style="font-size: small;"><span style="font-family: Calibri;"><strong>Note:</strong> For production use you will need to request an authentication type certificate from the certification authority.</span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">4.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Select Anonymous authentication and set the Authorization to all &ldquo;All users&rdquo; access to this ftp directory. Set both read/write properties.&nbsp; </span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">5.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Test access to your newly created ftp site using MS FTP using the command line or any third party FTP software. In our example we will be using FileZilla. </span></span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/2234.1.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/2234.1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/2234.1.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/2234.1.jpg" alt="" width="588" height="120" border="0" /></a></p>
<p>&nbsp;</p>
<p><span style="font-size: medium;"><strong><span style="text-decoration: underline;"><span><span style="font-family: Calibri;">Create an IIS managed user and ftp user isolation</span></span></span></strong></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">6.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Create two directories as follows:</span></span></p>
<ul>
<li><span style="font-size: small;"><span style="font-family: Calibri;">C:\inetpub\ftproot\LocalUser\rez (name of the user that will have access to their folder.</span></span></li>
</ul>
<p>&nbsp;</p>
<ul>
<li><span style="font-size: small;"><span style="font-family: Calibri;">C:\inetpub\adminfiles (this is for administrative access)</span></span></li>
</ul>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">7.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">In the IIS manager, select the webserver &gt; click on &ldquo;management service&rdquo; under the &ldquo;management&rdquo; subheading (if it&rsquo;s missing, add it in via a role service).</span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">8.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Under the connections sub group select an SSL certificate, in my case I am using a self-signed certificate called FTPS. <strong>Note</strong>: in production obtain a valid certificate from a certificate authority. Under the identity sub group select &ldquo;Windows credentials or IIS Manager credentials&rdquo; radio button. Specify any restrictions if you like under the IPv4 address restrictions to reject requests from certain machines. We will leave this out for now.</span></span>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">9.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Start the management service from the actions pane and you should see the following:</span></span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/7635.2.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/7635.2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/7635.2.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/7635.2.jpg" alt="" border="0" /></a></p>
<p><span style="font-family: Calibri; font-size: small;">10.</span>&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Select the server name in IIS again and double click IIS manager users under the management sub group &gt; add user from the actions pane and create a new user. In this example we will create a user named &ldquo;rez&rdquo;. Make sure this user is enabled.</span></span></p>
<p><span style="font-family: Times New Roman; font-size: small;">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/6064.3.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/6064.3.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/6064.3.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/6064.3.jpg" alt="" border="0" /></a></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">11.</span>&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Click on the ftp site and select authentication &gt; from there click custom providers from the actions pane and add the &ldquo;IISAuthMan Custom provider&rdquo;. Make sure it&rsquo;s enabled and disable all other authentication protocols.</span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">12.</span>&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Click on the IIS Manager permissions under the ftp site and make sure your user is allowed. In my example &ldquo;rez&rdquo; has been set to the &ldquo;allow user&rdquo;. You can also specify this user access to the ftp site under the FTP authorisation.</span></span></p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/6428.4.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/6428.4.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/6428.4.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/6428.4.jpg" alt="" border="0" /></a></p>
<p><span style="font-family: Calibri; font-size: small;">13.</span>&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Now create a new virtual directory under your ftp site pointing to C:\inetpub\adminfiles</span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">14.</span>&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Click on &ldquo;FTP User Isolation&rdquo; and select &ldquo;User name directory (disable global virtual directories)&rdquo;. This will restrict user&rsquo;s access to their own directories only. They will not be able to view any newly created virtual directories at the ftproot level. The result will be the following:</span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Times New Roman; font-size: small;"> <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/7266.6.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/7266.6.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/7266.6.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/7266.6.jpg" alt="" border="0" /></a></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">As you can see Rest.txt is within this &ldquo;rez&rdquo; directory. </span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/4846.7.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/4846.7.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/4846.7.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/4846.7.jpg" alt="" border="0" /></a></span></span></p>
<p><span style="font-size: medium; text-decoration: underline;"><strong><span><span style="font-family: Calibri;">So to summarise we:</span></span></strong></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">1. created a brand new test ftp site</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">2. created a folder structure to allow administrative access as well as specific directory access to an ftp user</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">3.&nbsp;created a new IIS managed user account</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">4. tested user ftp isolation</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Hope that helps.</span></span></p>
<p>&nbsp;</p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Rezwan Rahman</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>How to digitally sign a strong named assembly</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/how-to-digitally-sign-a-strong-named-assembly</link>
      <pubDate>Thu, 24 May 2012 03:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Rezwan R]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2012/05/24/how-to-digitally-sign-a-strong-named-assembly/</guid>
      <description><![CDATA[The following blog post demonstrates how to use a self-signed digital certificate to sign a strong...]]></description>
      <content:encoded><![CDATA[<p><span style="color: #800000; font-size: small;"><strong>The following blog post demonstrates how to use a self-signed digital certificate to sign a strong named assembly.</strong></span></p>
<p>Strong names guarantee name uniqueness by relying on unique key<br />pairs. No one can generate the same assembly name that you can, because an<br />assembly generated with one private key has a different name than an assembly<br />generated with another private key.</p>
<p>Strong names protect the version lineage of an assembly. A strong<br />name can ensure that no one can produce a subsequent version of your assembly.<br />Users can be sure that a version of the assembly they are loading comes from<br />the same publisher that created the version the application was built with.</p>
<p>Strong names provide a strong integrity check. Passing the .NET<br />Framework security checks guarantees that the contents of the assembly have not<br />been changed since it was built. <span style="background-color: #ffff00;">Note, however, that strong names in and of themselves do not imply a</span><br /><span style="background-color: #ffff00;">level of trust like that provided, for example, by a digital signature and </span><span style="background-color: #ffff00;">supporting certificate.</span></p>
<p><a href="https://msdn.microsoft.com/en-us/library/wd40t7ad.aspx">https://msdn.microsoft.com/en-us/library/wd40t7ad.aspx</a></p>
<p>&nbsp;</p>
<p><strong><span style="text-decoration: underline;">Creating a self-signed certificate using Makecert.exe</span></strong></p>
<p>Create a self-signed certificate using Makecert.exe.</p>
<p>Open an elevated command prompt and navigate to C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin&gt;</p>
<p>Then run the following command to create a self-signed certificate.&nbsp;</p>
<p><strong><em>C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin&gt;makecert &ndash;r &ndash;pe &ndash;n &ldquo;CN=&lt;cert name&gt;&rdquo; &ndash;b &lt;beginning date&gt; -e &lt;end date&gt; -sky &lt;subject key type&gt; -ss &lt;cert store&gt;</em></strong></p>
<p>I&nbsp;have used an x.500 certificate name of &ldquo;RezSign&rdquo; but you can choose to use any name you like. (If you would like to know what each of the switches mean,<br />please view this article: <a href="https://msdn.microsoft.com/en-US/library/bfsktky3(v=VS.80).aspx">https://msdn.microsoft.com/en-US/library/bfsktky3(v=VS.80).aspx</a>)</p>
<p>Press enter and you should see a &ldquo;succeeded&rdquo; message as in figure 1.</p>
<p>&nbsp;</p>
<p style="text-align: left;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/6523.Figure1.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/6523.Figure1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/6523.Figure1.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/6523.Figure1.jpg" alt="" border="0" /></a><br /><strong>Figure 1</strong></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="text-decoration: underline;">Check if the new self-signed certificate exists in the certificate store</span></strong></p>
<p>Run &ldquo;mmc&rdquo; from a run command and add the certificates snap in.</p>
<p>In the certificates window, select the Personal Store &gt; Certificates and view the list of certificates in the &ldquo;My User Account&rdquo; store.</p>
<p>Find the newly created certificate via the CN name specified earlier and double click it to view the certificate details.</p>
<p>You should see something similar to the screenshot in Figure 2. Make sure the message &ldquo;You have a private key that corresponds to this certificate.&rdquo; exists as shown.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/3808.Figure2.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/3808.Figure2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/3808.Figure2.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/3808.Figure2.jpg" alt="" border="0" /></a><br /><strong>Figure 2</strong></p>
<p><br />Click on the details tab and select &ldquo;edit properties&rdquo;.</p>
<p>You will notice in the general tab that you have a selection of certificate purposes. By default all certificate purposes will be selected but you can narrow down the scope as desired.</p>
<p><strong>Note:</strong> we are only interested in the &ldquo;code signing&rdquo; purpose. So when requesting a certificate from a CA make sure you mention this. See figure 3 for more information.</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/0083.Figure3.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/0083.Figure3.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/0083.Figure3.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/0083.Figure3.jpg" alt="" border="0" /></a><br /><strong>Figure 3</strong></p>
<p><br /><strong><span style="text-decoration: underline;">Exporting the certificate</span></strong></p>
<p><strong></strong>Right click this certificate &gt; All Tasks &gt; Export.</p>
<p>In the certificate export wizard, click next and select &ldquo;Yes, export the private key&rdquo; &gt; Next</p>
<p>In the export file format screen, select &ldquo;Personal Information Exchange &ndash;PKCS #12(.pfx) and check the &ldquo;include all certificates in the certification path if possible&rdquo; and &ldquo;Export all extended properties&rdquo; checkboxes &gt; Next</p>
<p>Provide a password for the file in the next screen and give your file to export a name. Use the same naming format as used earlier &gt; next &gt; finish.</p>
<p>You should now see the exported .pfx file in the location you saved it in.</p>
<p>&nbsp;</p>
<p><strong><span style="text-decoration: underline;">Importing the certificate with keyspec 2 (AT_SIGNATURE)</span></strong></p>
<p><strong>Note:</strong> we could have saved doing this stage if we ran the &ldquo;&ndash;sky signature&rdquo; during the self-signed certificate creation process.<br />However this is intended to be a guide to cover a scenario where you receive a certificate from a certificate authority that has specified the &ldquo;-sky exchange&rdquo; keyspec.</p>
<p>Backup your existing certificate in the certificate manager.</p>
<p>Open an elevated command prompt and import the pfx file we exported earlier using this command line:</p>
<p><strong><em></em></strong>&nbsp;</p>
<p><strong><em>certutil -importPFX -user &lt;pfxfilename&gt; AT_SIGNATURE</em></strong></p>
<p>&nbsp;</p>
<p>This will reimport the certificate we exported previously but will switch it from using KeySpec 1(AT_KEYEXCHANGE) to KeySpec 2(AT_SIGNATURE)</p>
<p>Enter the password for your certificate when prompted. You should then see the output as shown in figure 4.&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/3750.Figure4.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/3750.Figure4.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/3750.Figure4.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/3750.Figure4.jpg" alt="" border="0" /></a><br /><strong>Figure 4</strong></p>
<p>&nbsp;</p>
<p>Refresh the personal certificates store in the certificates console and make sure the newly imported certificate exists.</p>
<p>Now re-export this new certificate as you did earlier so we can use it to sign our assemblies.</p>
<p>&nbsp;</p>
<p><strong><span style="text-decoration: underline;">Importing the certificate into your project</span></strong></p>
<p>Open your solution in visual studio and right click the root &gt; properties</p>
<p>Click on the signing selection and check the &ldquo;Sign the assembly&rdquo; box.</p>
<p>Choose your exported &ldquo;.pfx&rdquo; file under the &ldquo;Choose a strong name key file&rdquo; dropdown box. Enter the password for it when prompted.</p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="text-decoration: underline;">Sign the assemblies with the certificate</span></strong></p>
<p>Build the solution to generate a dll in your bin directory.</p>
<p>Right click the dll &gt; properties and make a note of the tabs that display. You will notice there isn&rsquo;t one listed for &ldquo;digital signatures&rdquo;.</p>
<p>Now open an elevated command prompt and run the following command:</p>
<p><strong><em>C:\Program Files (x86)\Windows Kits\8.0\bin\x86&gt;signtool sign /f &ldquo;&lt;location of pfx file&gt;&rdquo; /p &ldquo;&lt;password&gt;&rdquo; /v &ldquo;&lt;location of the dll to sign&gt;&rdquo;</em></strong></p>
<p>You should see the following in Figure 5, if executed successfully:</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/0143.Figure5.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/0143.Figure5.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/0143.Figure5.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/0143.Figure5.jpg" alt="" border="0" /></a><br /><strong>Figure 5</strong></p>
<p>&nbsp;</p>
<p>Now go back to the dll you signed and select properties. Notice that there is a &ldquo;Digital Signatures&rdquo; tab now.&nbsp; As shown in Figure 6.</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/0842.Figure6.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/0842.Figure6.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/51/08/0842.Figure6.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-08/0842.Figure6.jpg" alt="" border="0" /></a><br /><strong>Figure 6</strong></p>
<p><strong></strong>&nbsp;</p>
<p><strong>Note: </strong>When you obtain a certificate from a reputable certification authority they will have a timestamp server which you can use to populate the &ldquo;signing time&rdquo; field with.</p>
<p>Congratulations you now have a digitally signed assembly.</p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="text-decoration: underline;">Summary</span></strong></p>
<p>We created a self-signed certificate using makecert.exe.</p>
<p>We learnt how to change the key exchange property for the certificate using certutil.exe.</p>
<p>We checked the purpose of the certificate to determine if it&rsquo;s eligible for code signing use.</p>
<p>We digitally signed our assembly using the signtool.exe.</p>
<p>HTH</p>
<p>&nbsp;</p>
<p>Rezwan Rahman</p>]]></content:encoded>
    </item>
    <item>
      <title>FTP service gets deleted on server restart</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/ftp-service-gets-deleted-on-server-restart</link>
      <pubDate>Thu, 10 May 2012 09:40:00 GMT</pubDate>
      <dc:creator><![CDATA[ashishsingh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2012/05/10/ftp-service-gets-deleted-on-server-restart/</guid>
      <description><![CDATA[If a registry DWORD "DeleteFlag" is set to 00000001 for the FTP service (or any service ) on IIS6...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: verdana,geneva; color: #003366;">If a registry DWORD "<strong>DeleteFlag</strong>" is set to <strong>00000001</strong> for the FTP service (or any service ) on IIS6 server at </span><span style="font-family: verdana,geneva; color: #003366;"><strong>[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFtpsvc]</strong> the service will be deleted on server restart. While this may be by design in cases when&nbsp;the service is uninstalled, but in such cases the service node has to be deleted from registry. If services manager is not able to delete the node for some reason and if the service is reinstalled, the "DeleteFlag" key will still be present and on server restart, the services manager will detect this key and delete the service and this may continue in a loop (reinstallation of service&nbsp;followed by a deletion of service on server restart). </span></p>
<p><span style="font-family: verdana,geneva; color: #003366;">To reproduce this issue, we can add a REG DWORD&nbsp; "DeleteFlag"&nbsp; with a&nbsp; value 00000001 at[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFtpsvc] on a Win 2003 server which has FTP installed </span><span style="font-family: verdana,geneva; color: #003366;">and restart the server. The service will be deleted on restart. </span></p>
<p><span style="font-family: verdana,geneva; color: #003366;">For Win2k8 R2, IIS 7.5, the location is </span><strong><span style="font-family: verdana,geneva; color: #003366;">[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ftpsvc] </span></strong><span style="font-family: verdana,geneva; color: #003366;">but the key is same, a</span><span style="font-family: verdana,geneva; color: #003366;">&nbsp;DWORD "<strong>DeleteFlag</strong>" set to <strong>00000001</strong>. </span></p>
<p><span style="font-family: verdana,geneva; color: #003366;">This might have happened due to third party software or a bad uninstallation accompanied with some permission issues due to which the MSFTPSvc/ftpsvc&nbsp;key could not be deleted. <span style="font-family: verdana,geneva; color: #003366;">The solution is to delete/rename the "<strong>DeleteFlag</strong>" key from the respective locations.</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Issues when using ASP.net delegation with client certificate mapping on IIS 7.0</title>
      <link>https://docs.microsoft.com/archive/blogs/httpcontext/issues-when-using-asp-net-delegation-with-client-certificate-mapping-on-iis-7-0</link>
      <pubDate>Tue, 27 Mar 2012 03:48:20 GMT</pubDate>
      <dc:creator><![CDATA[amehrot]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/httpcontext/2012/03/27/issues-when-using-asp-net-delegation-with-client-certificate-mapping-on-iis-7-0/</guid>
      <description><![CDATA[Recently I came across an issue that I would like to share with everyone.
We had a .net 3.5 web...]]></description>
      <content:encoded><![CDATA[<p><span style="color: #003366;">Recently I came across an issue that I would like to share with everyone.</span></p>
<p><span style="color: #003366;">We had a .net 3.5 web service hosted on IIS 7.0. We have configured it to accept a client certificate with a 1-to-1 mapping to a domain account. When presented with the cert the service appears to run as the account ok but it seems it cannot use delegation when connecting to SQL Server and fails with following error message:</span></p>
<p><span style="color: #003366;">Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'&rdquo;</span></p>
<p><span style="color: #003366;">We confirmed that client certificate mapping and kerberos settings required to make this work were in place.</span></p>
<p><span style="color: #003366;">Also the similar setup works fine on IIS 6.0. So the issue happens only with IIS 7.0 when using client certificate for delegation.</span></p>
<p><span style="color: #003366;">First is to understand the different logon types that Windows supports and what their capabilities are. I have listed only ones that we have come across here in this issue. </span></p>
<p><span style="color: #003366;">2 - Interactive - Intended for users who will be interactively using the machine, such as a user being logged on by a terminal server, remote shell, or similar process.</span></p>
<p><span style="color: #003366;">3 - Network - Intended for high performance servers to authenticate clear text passwords. LogonUser does not cache credentials for this logon type.</span></p>
<p><span style="color: #003366;">8 - NetworkCleartext - Windows 2000; Windows XP and Windows Server 2003 family: Preserves the name and password in the authentication packages, allowing the server to make connections to other network servers while impersonating the client. This allows a server to accept clear text credentials from a client, call LogonUser, verify that the user can access the system across the network, and still communicate with other servers. </span></p>
<p><span style="color: #003366;">In IIS 6.0 &amp; 7.0 when calling the LogonMethodEx API, the default type that is used is type 8 (Network Clear Text). This allows an NTLM connection between the IIS server and a backend server for anything that uses</span><br /><span style="color: #003366;">type 8. This includes Basic authentication, anonymous authentication (for IIS 6.0 only), and IIS certificate mapping authentication (but not AD certificate mapped authentication). The IIS client certificate mapping type is what applies to your situation. </span></p>
<p><span style="color: #003366;">In the IIS_schema.xml there is an enumeration under iisClientCertificateMappingAuthentication called "logonMethod" that has the following information: </span></p>
<p><span style="color: #003366;">&lt;enum name="Interactive" value="0" /&gt;</span></p>
<p><span style="color: #003366;">&lt;enum name="Batch" value="1" /&gt;</span></p>
<p><span style="color: #003366;">&lt;enum name="Network" value="2" /&gt;</span></p>
<p><span style="color: #003366;">&lt;enum name="ClearText" value="3" /&gt; </span></p>
<p><span style="color: #003366;">These enumeration names/values are what are exposed to an administrator to help control how IIS logs on a user mapped to a client certificate. The default setting is "ClearText" which is equivalent to NetworkClearText. </span></p>
<p><span style="color: #003366;">When a user is logged on using IIS client certificate mapping, the logic used returns a value of &ldquo;3&rdquo; instead of &ldquo;8&rdquo;. So the user is logged on with a &ldquo;Network&rdquo; token instead of the expected type &ldquo;NetworkClearText&rdquo;. Network tokens cannot be passed to a backend service so this configuration results in "NT AUTHORITY\ANONYMOUS" being passed to SQL which fails. </span></p>
<p><span style="color: #003366;">WORK AROUND: </span></p>
<p><span style="color: #003366;">We can change the values of the above enumeration to the following: </span></p>
<p><span style="color: #003366;">&lt;enum name="Interactive" value="2" /&gt;</span></p>
<p><span style="color: #003366;">&lt;enum name="Batch" value="4" /&gt;</span></p>
<p><span style="color: #003366;">&lt;enum name="Network" value="3" /&gt;</span></p>
<p><span style="color: #003366;">&lt;enum name="ClearText" value="8" /&gt;</span></p>
<p></p>
<p><span style="color: #003366;">To enable saving of the IIS_schema.xml file we need to:</span></p>
<p><span style="color: #003366;">1. Give "ownership" of the "C:\Windows\System32\inetsrv\config\schema" folder to Administrators under the "Advanced" button of the "Security" tab of the schema folder properties.</span></p>
<p><span style="color: #003366;">2. Give "Full Control" to Administrators on the Permissions tab.</span></p>
<p><span style="color: #003366;">3. Remove the "Read Only" attribute from IIS_schema.xml.</span></p>
<p><strong>Update: This issue is already fixed in IIS 7.5 (Windows 2008 R2). No schema changes are required.</strong></p>
<p></p>
<p><span style="color: #003366;">References:</span></p>
<p><span style="color: #003366;"><a href="https://blogs.msdn.com/b/saurabh_singh/archive/2008/12/25/service-principal-name-spn-checklist-for-kerberos-authentication-with-iis-7-0.aspx"><span style="color: #003366;">https://blogs.msdn.com/b/saurabh_singh/archive/2008/12/25/service-principal-name-spn-checklist-for-kerberos-authentication-with-iis-7-0.aspx</span></a></span></p>
<p><span style="color: #003366;"><a href="https://msdn.microsoft.com/en-us/library/aa291350(VS.71).aspx"><span style="color: #003366;">https://msdn.microsoft.com/en-us/library/aa291350(VS.71).aspx</span></a></span></p>
<p><span style="color: #003366;"></span>&nbsp;</p>
<p><span style="color: #003366;">Cross posted from my blog: <a href="https://blogs.msdn.com/b/amol/archive/2011/09/23/issues-when-using-asp-net-delegation-with-client-certificate-mapping-on-iis-7-x.aspx">https://blogs.msdn.com/b/amol/archive/2011/09/23/issues-when-using-asp-net-delegation-with-client-certificate-mapping-on-iis-7-x.aspx</a></span></p>]]></content:encoded>
    </item>
  </channel>
</rss>