<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.iis.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">rakkimk</title><subtitle type="html">working in iis, asp.net product support team at microsoft corporation
</subtitle><id>http://blogs.iis.net/rakkimk/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.iis.net/rakkimk/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20510.895">Community Server</generator><updated>2008-03-20T04:19:42Z</updated><entry><title>AppCmd syntax to add FTP IpV4 Address and Domain Restrictions</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/07/31/appcmd-syntax-to-add-ftp-ipv4-address-and-domain-restrictions.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/07/31/appcmd-syntax-to-add-ftp-ipv4-address-and-domain-restrictions.aspx</id><published>2008-07-31T14:34:21Z</published><updated>2008-07-31T14:34:21Z</updated><content type="html">&lt;p&gt;I just helped one of my customer writing a script which would add FTP IpV4 Address and Domain Restrictions into the applicationHost.config file. “Configuration Editor” came handy to nail this command. I would say, anybody and everybody wanted to play with AppCmd, and stuck, try your hands on this Configuration Editor which is a part of &lt;a href="http://iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1682"&gt;Administration Pack&lt;/a&gt; (still CTP2 at the time of writing) which gives you everything you need – Managed code (C#), Scription (JavaScript) and Command Line (Appcmd) syntax. Below are the commands:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;appcmd set config &amp;quot;TestFTP&amp;quot; /section:system.ftpServer/security/ipSecurity /+[ipAddress='65.2.3.68',subnetMask='6.1.2.100',allowed=’true’] /commit:appHost &lt;/p&gt;    &lt;p&gt;appcmd set config &amp;quot;TestFTP&amp;quot; /section:system.ftpServer/security/ipSecurity /+[ipAddress='65.2.3.68',allowed=’true’] /commit:appHost&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Hope this helps!&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2528151" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author></entry><entry><title>IIS – Rejecting a request from a specific client type(browser) | ISAPI Filter Example</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/07/23/iis-rejecting-a-request-from-a-specific-client-type-browser-isapi-filter-example.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/07/23/iis-rejecting-a-request-from-a-specific-client-type-browser-isapi-filter-example.aspx</id><published>2008-07-23T13:03:18Z</published><updated>2008-07-23T13:03:18Z</updated><content type="html">&lt;p&gt;Recently I’ve come across a discussion where a particular type of client request should be blocked. Say for an example, you need to block requests from a client called “TrustMe”; consider a scenario where you need to serve pages only for Internet Explorer 7 clients, not IE6.0 clients. This kind of requests are not so common, but there would be someone who may need this. Hence, this blog post :-) &lt;/p&gt;  &lt;p&gt;So, first of all we need to understand how we can differentiate between client browsers? How does a server identify what is the client browsing the site? It can identify through “User-Agent” request header. Example of an User-Agent sent from my IE6 client is below:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So, if you are able to check if your “TrustMe” client is a part of this header, you’ll be able to reject the response with 404 or whatever you want to do. You should now be remembering about URLScan’s [DenyHeaders] section helping here? &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;You cannot use that to reject requests with “User-Agent: TrustMe”. AFAIK, that section is used to reject *&lt;b&gt;any&lt;/b&gt;* requests coming with the mentioned header. It means, you can only decide on the header name, not the value of the header itself. &lt;/p&gt;  &lt;p&gt;Below is an example:&lt;/p&gt;  &lt;p&gt;[DenyHeaders]&lt;/p&gt;  &lt;p&gt;My-Header:&lt;/p&gt;  &lt;p&gt;This will reject *&lt;b&gt;any&lt;/b&gt;* requests, that have a request header of “My-Header:” regardless of its value. So, all of your requests will be rejected if you add “User-Agent:” to the [DenyHeaders]. &lt;/p&gt;  &lt;p&gt;AFAIK, only a custom ISAPI Filter can reject a response (with 404 or whatever) if coming from a specific user agent. Below is an example code to check this:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;/p&gt;    &lt;pre&gt;DWORD WINAPI &lt;/span&gt;&lt;span style="color: #a31515"&gt;__stdcall&lt;/span&gt;&lt;span style="color: #000000"&gt; HttpFilterProc(HTTP_FILTER_CONTEXT *pfc, DWORD NotificationType, VOID *pvData) 
{ 
&lt;/span&gt;&lt;span style="color: #a31515"&gt;    char&lt;/span&gt;&lt;span style="color: #000000"&gt; buffer[256];
    DWORD buffSize = &lt;/span&gt;&lt;span style="color: #a31515"&gt;sizeof&lt;/span&gt;&lt;span style="color: #000000"&gt;(buffer);
    HTTP_FILTER_PREPROC_HEADERS *p;
 
&lt;/span&gt;&lt;span style="color: #a31515"&gt;    switch&lt;/span&gt;&lt;span style="color: #000000"&gt; (NotificationType)  {

&lt;/span&gt;&lt;span style="color: #a31515"&gt;      case&lt;/span&gt;&lt;span style="color: #000000"&gt; SF_NOTIFY_PREPROC_HEADERS :
      p = (HTTP_FILTER_PREPROC_HEADERS *)pvData;
      BOOL bHeader = p-&amp;gt;GetHeader(pfc,&lt;/span&gt;&lt;span style="color: #008000"&gt;&amp;quot;User-Agent:&amp;quot;&lt;/span&gt;&lt;span style="color: #000000"&gt;,buffer,&amp;amp;buffSize); 
      CString UserAgent(buffer);
&lt;/span&gt;&lt;span style="color: #a31515"&gt;      if&lt;/span&gt;&lt;span style="color: #000000"&gt;(UserAgent.Find(&lt;/span&gt;&lt;span style="color: #008000"&gt;&amp;quot;TrustMe&amp;quot;&lt;/span&gt;&lt;span style="color: #000000"&gt;) != -1) {
&lt;/span&gt;&lt;span style="color: #ff00ff"&gt;        // Found; so changing the URL to be an unavailable URL, so your request would be &lt;br /&gt;        // rejected with 404; just as URLSCAN does
&lt;/span&gt;&lt;span style="color: #000000"&gt;        p-&amp;gt;SetHeader(pfc, &lt;/span&gt;&lt;span style="color: #008000"&gt;&amp;quot;url&amp;quot;&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #008000"&gt;&amp;quot;/Rejected-coz-of-Restricted-UserAgent&amp;quot;&lt;/span&gt;&lt;span style="color: #000000"&gt;);
      }
&lt;/span&gt;&lt;span style="color: #a31515"&gt;      return&lt;/span&gt;&lt;span style="color: #000000"&gt; SF_STATUS_REQ_HANDLED_NOTIFICATION; 
    }
&lt;/span&gt;&lt;span style="color: #a31515"&gt;    return&lt;/span&gt;&lt;span style="color: #000000"&gt; SF_STATUS_REQ_NEXT_NOTIFICATION; 
}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;But, this is always less secure, because User-Agent is easily configurable.&amp;#160; So, if you are planning to stop your site being used by some “attacking” user-agent, you can try using this. But, most of the time attackers are little intelligent than what we think them as, so they can easily change the request header. You can also think your own logic to accept only the clients you want to, rejecting the rest. &lt;/p&gt;

&lt;p&gt;So, if you want your ISAPI filter to reject requests from any IE6, you just need to check if the User-Agent header has the string “MSIE 6.0”. If you want help in writing an ISAPI filter, check my earlier blog posts &lt;a href="http://blogs.msdn.com/rakkimk/archive/tags/ISAPI+Filters/default.aspx"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Feel free to use the above code, but use at your own risk. &lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2508709" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author></entry><entry><title>IIS7 – Adding your UI extension to the IIS manager hierarchy</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/06/11/iis7-adding-your-ui-extension-to-the-iis-manager-hierarchy.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/06/11/iis7-adding-your-ui-extension-to-the-iis-manager-hierarchy.aspx</id><published>2008-06-12T02:37:47Z</published><updated>2008-06-12T02:37:47Z</updated><content type="html">&lt;p&gt;&lt;/p&gt;  &lt;p&gt;In the &lt;a href="http://blogs.msdn.com/webtopics/archive/2008/06/10/iis7-writing-your-first-custom-ui-module-with-all-winform-controls.aspx"&gt;last post&lt;/a&gt; I was talking about writing a simple UI extension which would appear like below:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7AddingyourUIextensiontotheIISmanager_716B/image_2.png"&gt;&lt;img title="image" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="140" alt="image" src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7AddingyourUIextensiontotheIISmanager_716B/image_thumb.png" width="194" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;How about you adding this to the IIS manager hierarchy – just below “Application Pools” and “FTP Sites”? Here is what you need to do additional to the steps you followed using my &lt;a href="http://blogs.msdn.com/webtopics/archive/2008/06/10/iis7-writing-your-first-custom-ui-module-with-all-winform-controls.aspx"&gt;previous blog&lt;/a&gt; on this. &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Add a new class to the project and name it as MyHierarchyProvider, and the file as MyHierarchyProvider.cs &lt;/li&gt;    &lt;li&gt;MyHierarchyProvider should derive from Microsoft.Web.Management.Client.HierarchyProvider &lt;/li&gt;    &lt;li&gt;It should have an internal class deriving from Microsoft.Web.Management.Client.HierarchyInfo where you can extend few properties to specify the display text, and which ModulePage it links to. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Below is a sample code which would define a class deriving from HierarchyProvider, and has an internal class with all its properties set. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-right: 0px; padding-left: 0px; background: #808080; padding-bottom: 0px; margin-left: 4px; margin-right: 4px; padding-top: 0px"&gt;   &lt;div style="border-right: #2e595c 1px solid; border-top: #2e595c 1px solid; background: #fff; left: -2px; border-left: #2e595c 1px solid; color: black; border-bottom: #2e595c 1px solid; position: relative; top: -2px"&gt;     &lt;div style="border-right: blue 1px solid; border-top: blue 1px solid; background: #3f73b6; border-left: blue 1px solid; width: 100%; color: white; border-bottom: blue 1px solid"&gt;&lt;span style="width: 100%"&gt;MyHierarchyProvider.cs&lt;/span&gt;&lt;/div&gt;      &lt;pre&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #0000ff"&gt; System;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #0000ff"&gt; System.Collections.Generic;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #0000ff"&gt; System.Text;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #0000ff"&gt; Microsoft.Web.Management.Client;

&lt;/span&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;&lt;span style="color: #0000ff"&gt; MyIIS7UIExtensions
{
    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;internal&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #a31515"&gt;MyHierarchyProvider&lt;/span&gt;&lt;span style="color: #0000ff"&gt; : &lt;/span&gt;&lt;span style="color: #a31515"&gt;HierarchyProvider
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;    {
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt; MyHierarchyProvider(&lt;/span&gt;&lt;span style="color: #a31515"&gt;IServiceProvider&lt;/span&gt;&lt;span style="color: #0000ff"&gt; serviceProvider)
            : &lt;/span&gt;&lt;span style="color: #0000ff"&gt;base&lt;/span&gt;&lt;span style="color: #0000ff"&gt;(serviceProvider)
        {
        }
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #a31515"&gt;HierarchyInfo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;[] GetChildren(&lt;/span&gt;&lt;span style="color: #a31515"&gt;HierarchyInfo&lt;/span&gt;&lt;span style="color: #0000ff"&gt; item)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #0000ff"&gt; (item.NodeType == &lt;/span&gt;&lt;span style="color: #a31515"&gt;HierarchyInfo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;.ServerConnection)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #a31515"&gt;HierarchyInfo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;[] { &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #a31515"&gt;DemoHierarchyInfo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #0000ff"&gt;) };
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #0000ff"&gt;;
        }
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;internal&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #a31515"&gt;DemoHierarchyInfo&lt;/span&gt;&lt;span style="color: #0000ff"&gt; : &lt;/span&gt;&lt;span style="color: #a31515"&gt;HierarchyInfo
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;        {

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt; DemoHierarchyInfo(&lt;/span&gt;&lt;span style="color: #a31515"&gt;IServiceProvider&lt;/span&gt;&lt;span style="color: #0000ff"&gt; serviceProvider)
                : &lt;/span&gt;&lt;span style="color: #0000ff"&gt;base&lt;/span&gt;&lt;span style="color: #0000ff"&gt;(serviceProvider)
            {
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #0000ff"&gt; NodeType
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;get
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;                {
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #ff00ff"&gt;&amp;quot;MyHierarchyProvider&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;;
                }
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="color: #0000ff"&gt; SupportsChildren
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;get
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;                {
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;&lt;span style="color: #0000ff"&gt;;
                }
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #0000ff"&gt; Text
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;get
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;                {
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #ff00ff"&gt;&amp;quot;SimpleIIS7UIModule&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;;
                }
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="color: #0000ff"&gt; OnSelected()
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #0000ff"&gt; Navigate(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;&lt;span style="color: #0000ff"&gt;(&lt;/span&gt;&lt;span style="color: #a31515"&gt;MyPage&lt;/span&gt;&lt;span style="color: #0000ff"&gt;));
            }
        }
    }
}&lt;/span&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;After doing above, you might also want to make some changes in your existing Module class, so that it has the information about the hierarchy. If you have downloaded the sample which I have linked in my &lt;a href="http://blogs.msdn.com/webtopics/archive/2008/06/10/iis7-writing-your-first-custom-ui-module-with-all-winform-controls.aspx"&gt;earlier&lt;/a&gt; post, you should be having 2 lines commented (I forgot to remove them last time.. lol) – uncomment them, and you are good to go. However below are the 2 lines which you need to add to link this hierarchy provider with our module. &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;span style="color: #0000ff"&gt;IExtensibilityManager&lt;/span&gt;&lt;span style="color: #2b91af"&gt; extensibilityManager = (&lt;/span&gt;&lt;span style="color: #0000ff"&gt;IExtensibilityManager&lt;/span&gt;&lt;span style="color: #2b91af"&gt;)GetService(&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeof&lt;/span&gt;&lt;span style="color: #2b91af"&gt;(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;IExtensibilityManager&lt;/span&gt;&lt;span style="color: #2b91af"&gt;)); 
      &lt;br /&gt;extensibilityManager.RegisterExtension(&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeof&lt;/span&gt;&lt;span style="color: #2b91af"&gt;(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;HierarchyProvider&lt;/span&gt;&lt;span style="color: #2b91af"&gt;), &lt;/span&gt;&lt;span style="color: #a31515"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;MyHierarchyProvider&lt;/span&gt;&lt;span style="color: #2b91af"&gt;(serviceProvider));&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This would register the HierarchyProvider class to our module, and after building our assembly, and placing the DLL in GAC successfully, and after having all the administrationHost.config settings, you must see the below:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7AddingyourUIextensiontotheIISmanager_716B/image_4.png"&gt;&lt;img title="image" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="230" alt="image" src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7AddingyourUIextensiontotheIISmanager_716B/image_thumb_1.png" width="621" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And, you can change the Text property of our HierachyInfo which is an internal class to change the display name appearing in the UI. Don’t hesitate to put your questions or anything you want to let me know through comments! &lt;/p&gt;

&lt;p&gt;Happy learning. &lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2417720" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author></entry><entry><title>IIS7 - Writing your first custom UI module with all winform controls</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/06/09/iis7-writing-your-first-custom-ui-module-with-all-winform-controls.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/06/09/iis7-writing-your-first-custom-ui-module-with-all-winform-controls.aspx</id><published>2008-06-10T01:04:00Z</published><updated>2008-06-10T01:04:00Z</updated><content type="html">
&lt;p&gt;You should follow &lt;a href="http://learn.iis.net/page.aspx/269/how-to-create-a-simple-iis-manager-module/" mce_href="http://learn.iis.net/page.aspx/269/how-to-create-a-simple-iis-manager-module/"&gt;this&lt;/a&gt; article on IIS.net to create your first “simple” IIS7 UI extension which would just display a message box when loaded. &lt;/p&gt;
 
&lt;p&gt;In this blog, I’m going to explain you how you could design a UI module where you can add any UI control that you might add to a WinForm. &lt;/p&gt;
 
&lt;p&gt;Basically, the UI which appears in the middle pane is just an extension of Windows Form, and you can easily design that using Visual Studio. For example, the below “SSL settings” page has few checkboxes, radio buttons, and Apply/Cancel on the Actions pane. &lt;/p&gt;
 
&lt;blockquote&gt; 
&lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_2.png" mce_href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_2.png"&gt;&lt;img src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb.png" title="image" style="border-width: 0px;" alt="image" mce_src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb.png" border="0" height="252" width="530"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;
 
&lt;p&gt;All your controls should be placed or added into a class within your assembly which should derive from Microsoft.Web.Management.Client.Win32.ModulePage. &lt;/p&gt;
 
&lt;p&gt;Before we start adding a class deriving from ModulePage, please make sure you have completed your Module and ModuleProvider classes by following &lt;a href="http://learn.iis.net/page.aspx/269/how-to-create-a-simple-iis-manager-module/" mce_href="http://learn.iis.net/page.aspx/269/how-to-create-a-simple-iis-manager-module/"&gt;this&lt;/a&gt; article, and also make sure your assembly would be put in GAC. Your project should look like below with DemoKey.snk, and also the proper references to the Microsoft.Web.Management, and Microsoft.Web.Administration:&lt;/p&gt;
 
&lt;blockquote&gt; 
&lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_4.png" mce_href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_4.png"&gt;&lt;img src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb_1.png" title="image" style="border-width: 0px;" alt="image" mce_src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb_1.png" border="0" height="224" width="368"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;
 
&lt;p&gt;&lt;b&gt;&lt;u&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;
 
&lt;p&gt;&lt;b&gt;&lt;u&gt;Adding a ModulePage&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;
 
&lt;p&gt;Add a new class to the existing project, and name it as MyPage.cs. Derive the class from Microsoft.Web.Management.Client.Win32.ModulePage. Now, let’s try to add some code which runs when this ModulePage runs – let’s put a MessageBox on the constructor. &lt;/p&gt;
 
&lt;p&gt;Below is how my code looks now:&lt;/p&gt;
 
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding: 0px; background: rgb(128, 128, 128) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-left: 4px; margin-right: 4px;"&gt; &lt;div style="border: 1px solid rgb(46, 89, 92); background: rgb(255, 255, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; left: -2px; color: black; position: relative; top: -2px;"&gt; &lt;div style="border: 1px solid blue; background: rgb(63, 115, 182) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; color: white;"&gt;&lt;span style="width: 100%;"&gt;Code Snippet displaying a simple message box&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; System;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; System.Windows.Forms;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; Microsoft.Web.Management.Client.Win32;&lt;br&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;namespace&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; MyIIS7UIExtensions&lt;br&gt;{&lt;br&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;internal&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyPage&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; : &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ModulePage&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;    {&lt;br&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; MyPage()&lt;br&gt;        {&lt;br&gt;            &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MessageBox&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;.Show(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 255);"&gt;"Testing this!!!!"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;);&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;You should build the assembly, and put it in the assembly (dll) in the GAC, and add the below to your administrationHost.config:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;lt;moduleProviders&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="MyIIS7UIExtensions" type="MyIIS7UIExtensions.MyModuleProvider, MyIIS7UIExtensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=db9daa3d2ea5f6fd" /&amp;gt;&lt;/p&gt;

&lt;p&gt;........&lt;/p&gt;

&lt;p&gt;&amp;lt;/moduleProviders&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;lt;modules&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="MyIIS7UIExtensions" /&amp;gt;&lt;/p&gt;

&lt;p&gt;.........&lt;/p&gt;

&lt;p&gt;&amp;lt;/module&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You should see the below in your IIS manager. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_6.png" mce_href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_6.png"&gt;&lt;img src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb_2.png" title="image" style="border-width: 0px;" alt="image" mce_src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb_2.png" border="0" height="192" width="282"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you double click on the “MyIIS7UIExtensions”, you should see the below message box, and if you click OK, then you would see the whole UI, but no controls. Just because you haven’t added them still J&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/clip_image008_2.jpg" mce_href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/clip_image008_2.jpg"&gt;&lt;img src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/clip_image008_thumb.jpg" title="clip_image008" style="border-width: 0px;" alt="clip_image008" mce_src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/clip_image008_thumb.jpg" border="0" height="147" width="144"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_8.png" mce_href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_8.png"&gt;&lt;img src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb_3.png" title="image" style="border-width: 0px;" alt="image" mce_src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb_3.png" border="0" height="234" width="365"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you get to this stage, then you are almost there in making your real IIS7 UI extension, rest of the steps are really easy if you are a windows forms programmer. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;u&gt;Adding Winform controls to our UI Extension&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Let’s say you want to have a combo box listing all the application pools that are available. How to design that? First, you have to add the combo box inside your ModulePage. &lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre&gt;        &lt;span style="color: rgb(43, 145, 175);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; MyPage()&lt;br&gt;        {&lt;br&gt;            &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.Controls.Add(&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ComboBox&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;());&lt;br&gt;        }&lt;/span&gt;&lt;/pre&gt;The above code will add a new combo box. But, you want to really specify how it should appear, and its co-ordinates, don’t you? 
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding: 0px; background: rgb(128, 128, 128) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-left: 4px; margin-right: 4px;"&gt;
&lt;div style="border: 1px solid rgb(46, 89, 92); background: rgb(255, 255, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; left: -2px; color: black; position: relative; top: -2px;"&gt;
&lt;div style="border: 1px solid blue; background: rgb(63, 115, 182) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; color: white;"&gt;&lt;span style="width: 100%;"&gt;Modified constructor to specify the co-ordinates for the combo box&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;       &lt;span style="color: rgb(43, 145, 175);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; MyPage()&lt;br&gt;        {&lt;br&gt;            &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ComboBox&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; comboBox1;&lt;br&gt;            comboBox1 = &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; System.Windows.Forms.&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ComboBox&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;();&lt;br&gt;            comboBox1.Location = &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; System.Drawing.&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Point&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(20, 20);&lt;br&gt;            comboBox1.Name = &lt;/span&gt;&lt;span style="color: rgb(255, 0, 255);"&gt;"comboBox1"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br&gt;            comboBox1.Size = &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; System.Drawing.&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Size&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(121, 21);&lt;br&gt;            comboBox1.TabIndex = 0;&lt;br&gt;            &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.Controls.Add(&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.comboBox1);&lt;br&gt;        } &lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Now, imagine if you want to add TextBoxes, Buttons, et al, and define the event handlers such as to handle button click, how much time you would invest in designing this manually? Don’t you love dragging and dropping controls to create your ModulePage as a so-called Windows Form? &lt;/p&gt;

&lt;p&gt;Don’t worry! I’ve an easy way to overcome this difficulty. Read &lt;a href="http://blogs.iis.net/rakkimk/archive/2008/03/05/iis7-making-iis7-manager-ui-extension-development-easier-little-vs-trick.aspx" mce_href="http://blogs.iis.net/rakkimk/archive/2008/03/05/iis7-making-iis7-manager-ui-extension-development-easier-little-vs-trick.aspx"&gt;this earlier blog of mine&lt;/a&gt; where I explain this little VS trick to minimize your development time to design this UI extension. But come back to this blog after visiting that, I’m going to further discuss how to display the available application pools on the combo box, and going to provide a button to say the selected application pool to recycle. &lt;/p&gt;

&lt;p&gt;And, my IIS UI extension looks like below now:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_10.png" mce_href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_10.png"&gt;&lt;img src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb_4.png" title="image" style="border-width: 0px;" alt="image" mce_src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7WritingyourfirstcustomUImodulewithal_59FF/image_thumb_4.png" border="0" height="255" width="514"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you do not see the below after you’ve designed using Visual Studio using the above method, you might also want to verify is the InitializeComponent() method is called in the constructor – that’s the function where all your stuffs get added to the form (ModulePage). &lt;/p&gt;

&lt;p&gt;Now, let’s write a method which would fill the combo box with all the application pools that are available by reading the IIS configuration store using Microsoft.Web.Adminsitration. Let’s name our function as LoadAppPoolInfo(), and call that from our constructor after calling InitializeComponent() method. &lt;/p&gt;

&lt;p&gt;Your code should look like below:&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding: 0px; background: rgb(128, 128, 128) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-left: 4px; margin-right: 4px;"&gt;
&lt;div style="border: 1px solid rgb(46, 89, 92); background: rgb(255, 255, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; left: -2px; color: black; position: relative; top: -2px;"&gt;
&lt;div style="border: 1px solid blue; background: rgb(63, 115, 182) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; color: white;"&gt;&lt;span style="width: 100%;"&gt;Added a ServerManager, and modified the constructor to call LoadAppPoolInfo() and defined that as well&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;        Microsoft.Web.Administration.&lt;span style="color: rgb(0, 0, 255);"&gt;ServerManager&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; manager = &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Microsoft.Web.Administration.ServerManager();&lt;br&gt;        &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; MyPage()&lt;br&gt;        {&lt;br&gt;            InitializeComponent();&lt;br&gt;            LoadAppPoolInfo();&lt;br&gt;        }&lt;br&gt;&lt;br&gt;        &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; LoadAppPoolInfo()&lt;br&gt;        {&lt;br&gt;            &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;foreach&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (Microsoft.Web.Administration.WorkerProcess a &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;in&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; manager.WorkerProcesses)&lt;br&gt;                comboBox2.Items.Add(a.AppPoolName);&lt;br&gt;        }&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;And, your UI extension should now display the available application pools in the combo box. Go ahead and add a button click event handler for the button which you’ve already put inside our ModulePage like below:&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;        private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; button1_Click(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;object&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; sender, &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;EventArgs&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; e)&lt;br&gt;        {&lt;br&gt;            manager.ApplicationPools[comboBox2.SelectedItem.ToString()].Recycle();&lt;br&gt;        }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Now, go ahead and play with all the classes in Microsoft.Web.Administration to make your own modules to do a lot more than what’s provided in the default IIS7 manager UI. &lt;/p&gt;


&lt;p&gt;
You can download my sample project here:
&lt;/p&gt;

&lt;p&gt;&lt;iframe src="http://cid-d51bd0fea1143bbd.skydrive.live.com/embedrowdetail.aspx/MSDNBlogAttachments/SimpleUIExtension.zip" marginheight="0" marginwidth="0" style="border: 1px solid rgb(221, 229, 233); margin: 3px; padding: 0pt; width: 240px; height: 66px; background-color: rgb(255, 255, 255);" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;Please do post your questions if you have any. &lt;br&gt;&lt;/p&gt;
&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2411988" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="IIS7" scheme="http://blogs.iis.net/rakkimk/archive/tags/IIS7/default.aspx" /></entry><entry><title>IIS7 – Prevent the server sending its private IP address for a request made by HTTP/1.0 clients with no host header</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/06/07/iis7-prevent-the-server-sending-its-private-ip-address-for-a-request-made-by-http-1-0-clients-with-no-host-header.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/06/07/iis7-prevent-the-server-sending-its-private-ip-address-for-a-request-made-by-http-1-0-clients-with-no-host-header.aspx</id><published>2008-06-07T18:35:17Z</published><updated>2008-06-07T18:35:17Z</updated><content type="html">&lt;p&gt;Do you remember this problem earlier with IIS sending the server’s private address for a request made for a non host-header site in its headers? You were setting UseHostName or SetHostName property in the metabase to stop the server sending the private IP address. &lt;a href="http://support.microsoft.com/?kbid=834141"&gt;This KB article&lt;/a&gt; had the hotfix details, and you need to follow the more information section to be able to stop the server sending. &lt;/p&gt;  &lt;p&gt;So, what now in IIS7? No metabase right? There is no equivalent to UseHostName, but system.webServer/serverRuntime/alternateHostName&amp;#160; is the equivalent to the SetHostName. Below is the appcmd syntax to set this:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;pre&gt;appcmd&lt;/span&gt;&lt;span style="color: #0000ff"&gt;.&lt;/span&gt;&lt;span style="color: #000000"&gt;exe&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;set&lt;/span&gt;&lt;span style="color: #0000ff"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;config&lt;/span&gt;&lt;span style="color: #0000ff"&gt;  -&lt;/span&gt;&lt;span style="color: #000000"&gt;section&lt;/span&gt;&lt;span style="color: #0000ff"&gt;:system.webServer/serverRuntime /alternateHostName:&lt;/span&gt;&lt;span style="color: #00ffff"&gt;&amp;quot;YourServerName&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;  /&lt;/span&gt;&lt;span style="color: #000000"&gt;commit&lt;/span&gt;&lt;span style="color: #0000ff"&gt;:apphost&lt;/span&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;p&gt;&lt;/span&gt;I did use the IIS7 Configuration Editor’s “Generate Script” option to generate the above, isn’t that really handy? &lt;/p&gt;&lt;/pre&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2408666" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="IIS7" scheme="http://blogs.iis.net/rakkimk/archive/tags/IIS7/default.aspx" /></entry><entry><title>Getting "Unable to step. The operation could not be completed. A retry should be performed" while debugging in Visual Studio</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/06/07/getting-quot-unable-to-step-the-operation-could-not-be-completed-a-retry-should-be-performed-quot-while-debugging-in-visual-studio.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/06/07/getting-quot-unable-to-step-the-operation-could-not-be-completed-a-retry-should-be-performed-quot-while-debugging-in-visual-studio.aspx</id><published>2008-06-07T18:06:00Z</published><updated>2008-06-07T18:06:00Z</updated><content type="html">&lt;p&gt;&lt;b&gt;&lt;u&gt;Problem Description        &lt;br&gt;&lt;/u&gt;&lt;/b&gt;    &lt;br&gt;Getting below error messages while debugging an ASP.NET website in Visual Studio 2005 SP1&lt;/p&gt;  &lt;p&gt;when stepping through, getting &lt;/p&gt;  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Unable to step. The operation could not be completed. A retry should be performed" &lt;/p&gt;  &lt;p&gt;After clicking OK on the dialog, getting &lt;/p&gt;  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "The debugger cannot continue running the process. The operation could not be completed. A retry should be performed." &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;Cause        &lt;br&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;A known issue with the Visual Studio debugger causing this problem. There is a race condition that happens when all of the following are true: &lt;/p&gt;  &lt;p&gt;1. Script debugging is enabled in IE    &lt;br&gt;2. User is debugging IE and another process     &lt;br&gt;3. The other process stops (hits breakpoint, step operation completes, stops at an exception, etc) at a moment when IE is not running script code     &lt;br&gt;4. IE starts running script code at roughly the same moment that the user hits F10/F5 in Visual Studio. The most likely reason for this to happen is that the code from 'setTimeout' is run - there could be other reasons as well. &lt;br&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;Workaround        &lt;br&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;1. If you hit this problem, you can try detaching and reattaching the debugger. &lt;/p&gt;  &lt;p&gt;-or-    &lt;br&gt;2. This problem happens when debugging ASP.NET and when script debugging is enabled in IE. If you disable script debugging in IE, or toggle it on and off when switching between debugger server-side and client-side problems, you would be able to work around the issue. &lt;/p&gt;  &lt;p&gt;-or-    &lt;br&gt;3. If your web application is using setTimeout, you may be able to avoid or at least reduce the problem by doing something to ensure that script runs less often. This could mean increasing the timeout value, or this could mean adding conditions around when setTimeout is used. &lt;/p&gt;  &lt;p&gt;Above are the recommendations made by &lt;a href="http://blogs.msdn.com/greggm/" mce_href="http://blogs.msdn.com/greggm/"&gt;Gregg Miskelly&lt;/a&gt; of Visual Studio debugger development team. I’ve worked on this issue from developer support reported by one of our extremely helpful customer who gave us a perfect environment to troubleshoot and identify this issue. For this case I’ve worked on, disabling the script debugging in IE made the trick. &lt;/p&gt;  &lt;p&gt;Check out &lt;a href="http://forums.msdn.microsoft.com/en-US/vsdebug/thread/2320a943-d52d-437a-abec-6f1e9f929b52" mce_href="http://forums.msdn.microsoft.com/en-US/vsdebug/thread/2320a943-d52d-437a-abec-6f1e9f929b52"&gt;http://forums.msdn.microsoft.com/en-US/vsdebug/thread/2320a943-d52d-437a-abec-6f1e9f929b52&lt;/a&gt; for more details. &lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2408635" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="Debugging" scheme="http://blogs.iis.net/rakkimk/archive/tags/Debugging/default.aspx" /><category term="Visual Studio" scheme="http://blogs.iis.net/rakkimk/archive/tags/Visual+Studio/default.aspx" /></entry><entry><title>IIS7 - Command line tool (managed) to set FTP properties in Active Directory</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/06/04/iis7-command-line-tool-managed-to-set-ftp-properties-in-active-directory.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/06/04/iis7-command-line-tool-managed-to-set-ftp-properties-in-active-directory.aspx</id><published>2008-06-04T19:19:19Z</published><updated>2008-06-04T19:19:19Z</updated><content type="html">&lt;p&gt;You would have already seen &lt;a href="http://blogs.msdn.com/rakkimk/archive/2007/11/28/iis7-ui-module-for-setting-ftp-active-directory-user-isolation-properties.aspx"&gt;this UI module&lt;/a&gt; of mine to set the FTP properties in Active Directory. With IISFtp.vbs not working on WS2008 or Vista, this would be very handy tool to use the FTP AD user isolation. You can very well set the required properties directly on the Active Directory schema yourself, but here is a command line utility to do this. &lt;/p&gt;  &lt;p&gt;If you are an administrator who would not use UI stuffs, or you don't want to put on the IIS manager on the server, this one is for you. I created this for one of my customer, and here is this for all. &lt;/p&gt;  &lt;p&gt;&lt;iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 66px; background-color: #ffffff" marginwidth="0" marginheight="0" src="http://cid-d51bd0fea1143bbd.skydrive.live.com/embedrowdetail.aspx/MSDNBlogAttachments/FTPADPropSetting.exe" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;p&gt;Hope this helps!&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2401892" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author></entry><entry><title>IIS - Sample ISAPI Filter doing Redirection to another website</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/05/09/iis-sample-isapi-filter-doing-redirection-to-another-website.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/05/09/iis-sample-isapi-filter-doing-redirection-to-another-website.aspx</id><published>2008-05-09T23:17:00Z</published><updated>2008-05-09T23:17:00Z</updated><content type="html">&lt;P&gt;I know I'm in a very old world of writing ISAPI Filters to do the redirection instead of just creating an IHttpModule and plug it directly in the IIS7 request pipeline. But, one of my customer wanted this ISAPI filter and I made a fairly simple ISAPI Filter to do the redirection. &lt;/P&gt;
&lt;P&gt;Below sample doesn't do any checks, or maintains any lists of mapped URLs, but just a simple redirection of all the requests to &lt;A href="http://www.live.com/" mce_href="http://www.live.com"&gt;http://www.live.com&lt;/A&gt;. Feel free to modify it accommodating your need. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #2e595c 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #2e595c 1px solid; PADDING-LEFT: 0px; BACKGROUND: #fff; LEFT: -2px; PADDING-BOTTOM: 0px; MARGIN-LEFT: 4px; BORDER-LEFT: #2e595c 1px solid; COLOR: black; MARGIN-RIGHT: 4px; PADDING-TOP: 0px; BORDER-BOTTOM: #2e595c 1px solid; POSITION: relative; TOP: -2px"&gt;
&lt;DIV style="BORDER-RIGHT: blue 1px solid; BORDER-TOP: blue 1px solid; BACKGROUND: #3f73b6; BORDER-LEFT: blue 1px solid; WIDTH: 100%; COLOR: white; BORDER-BOTTOM: blue 1px solid"&gt;&lt;SPAN style="WIDTH: 100%"&gt;Code Snippet&lt;/SPAN&gt;&lt;/DIV&gt;&lt;PRE&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;#include&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;&amp;lt;stdio.h&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;#include&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;&amp;lt;stdlib.h&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;#include&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;&amp;lt;afx.h&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;#include&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;&amp;lt;afxisapi.h&amp;gt;

&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;BOOL WINAPI &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;__stdcall&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; GetFilterVersion(HTTP_FILTER_VERSION *pVer) 
{ 
  pVer-&amp;gt;dwFlags = (SF_NOTIFY_PREPROC_HEADERS ); 
  CFile myFile(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"C:\\ISAPILOG\\URLs.html"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;, CFile::modeCreate);
  myFile.Close();
  pVer-&amp;gt;dwFilterVersion = HTTP_FILTER_REVISION; 
  strcpy(pVer-&amp;gt;lpszFilterDesc, &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"Sample Redirection ISAPI"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;); 
  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;return&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; TRUE; 
} 

DWORD WINAPI &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;__stdcall&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; HttpFilterProc(HTTP_FILTER_CONTEXT *pfc, DWORD NotificationType, VOID *pvData) 
{ 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;   char&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; buffer[256];
   DWORD buffSize = &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;sizeof&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;(buffer);
   HTTP_FILTER_PREPROC_HEADERS *p;
   CHttpFilterContext *chc;
   chc = (CHttpFilterContext *)pfc;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;   char&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; *newUrl;
   CFile myFile(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"C:\\ISAPILOG\\URLs.html"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;, CFile::modeWrite);

&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;   switch&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; (NotificationType)  { 

&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;   case&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; SF_NOTIFY_PREPROC_HEADERS :

   p = (HTTP_FILTER_PREPROC_HEADERS *)pvData;

&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;   char&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; newUrl[50];
   wsprintf(newUrl, &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"http://www.live.com/"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;);

&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;   char&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; szTemp[50];
   wsprintf(szTemp, &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"Location: %s\r\n\r\n"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;,newUrl);

   pfc-&amp;gt;ServerSupportFunction (pfc,
                            SF_REQ_SEND_RESPONSE_HEADER,
                            (PVOID) &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"302 Redirect"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;,
                            (DWORD) szTemp,0); 

   myFile.SeekToEnd();
   myFile.Write(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"&amp;lt;BR&amp;gt;&amp;lt;B&amp;gt; Orignial URL : &amp;lt;/B&amp;gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;,strlen(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"&amp;lt;BR&amp;gt;&amp;lt;B&amp;gt; Orignial URL : &amp;lt;/B&amp;gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;));
   BOOL bHeader = p-&amp;gt;GetHeader(pfc,&lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;,buffer,&amp;amp;buffSize); 
   CString myURL(buffer);
   myURL.MakeLower(); 
   myFile.Write(buffer,buffSize);
   
   myFile.Write(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;" &amp;lt;B&amp;gt;New URL : &amp;lt;/B&amp;gt; "&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;,strlen(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #00ff00"&gt;" &amp;lt;B&amp;gt;New URL : &amp;lt;/B&amp;gt; "&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;));
   myFile.Write(newUrl,strlen(newUrl));
   myFile.Close();

&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;   return&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; SF_STATUS_REQ_HANDLED_NOTIFICATION; 
   }
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;  return&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt; SF_STATUS_REQ_NEXT_NOTIFICATION; 
} &lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT color=#000000&gt;Above is my sample, You might want to check my &lt;A href="http://blogs.msdn.com/rakkimk/archive/2007/03/01/writing-a-simple-isapi-filter.aspx" mce_href="http://blogs.msdn.com/rakkimk/archive/2007/03/01/writing-a-simple-isapi-filter.aspx"&gt;earlier ISAPI blog post&lt;/A&gt; to get the .def file and steps to create the DLL. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000&gt;&lt;BR&gt;Hope this helps!&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT style="BACKGROUND-COLOR: #808080"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2349266" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="ISAPI" scheme="http://blogs.iis.net/rakkimk/archive/tags/ISAPI/default.aspx" /><category term="IIS" scheme="http://blogs.iis.net/rakkimk/archive/tags/IIS/default.aspx" /></entry><entry><title>How to configure IIS 7.0 for ODBC logging?</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/04/16/how-to-configure-iis-7-0-for-odbc-logging.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/04/16/how-to-configure-iis-7-0-for-odbc-logging.aspx</id><published>2008-04-16T20:54:46Z</published><updated>2008-04-16T20:54:46Z</updated><content type="html">&lt;p&gt;If you select Log File format as &amp;#8220;Custom&amp;#8221; in the IIS manager, it doesn&amp;#8217;t give you options to configure ODBC logging in the UI. Instead, it just gives you an alert saying it cannot be configured through IIS manager which you already know. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/60aa23eba27b_133B/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="94" alt="image" src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/60aa23eba27b_133B/image_thumb.png" width="205" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;But, in the previous versions of IIS, you would see the below: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/60aa23eba27b_133B/clip_image004_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="314" alt="clip_image004" src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/60aa23eba27b_133B/clip_image004_thumb.jpg" width="351" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So, in this post I will explain how to configure IIS7.0 site for ODBC logging. You still want to check out &lt;a href="http://support.microsoft.com/kb/245243"&gt;this KB&lt;/a&gt; for the database, table related information which needs to be created prior to this IIS configuration change. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Changing LogFile Format and the customLogPluginClsid&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To configure ODBC, you might need to know the log plugin ID for the ODBC logging. In IIS 6.0, it was LogModuleId, and if you do a search for &amp;#8220;ODBC logging&amp;#8221; in your Metabase.XML file, you might find this property with value &amp;#8220;{FF16065B-DE82-11CF-BC0A-00AA006111E0}&amp;#8221;. We are going to use the same in IIS 7.0, but in the ApplicationHost.config file as customLogPluginClsid. &lt;/p&gt;  &lt;p&gt;You need to find the &amp;lt;logFile&amp;gt; node in ApplicationHost.config, and that should look like below:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;lt;logFile customLogPluginClsid=&amp;quot;{FF16065B-DE82-11CF-BC0A-00AA006111E0}&amp;quot; logFormat=&amp;quot;Custom&amp;quot; /&amp;gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Below are the AppCmds to do this:&lt;/p&gt;  &lt;blockquote&gt;appcmd set site /site.name:&amp;quot;Default Web Site&amp;quot; /logFile.customLogPluginClsid:&amp;quot;{FF16065B-DE82-11CF-BC0A-00AA006111E0}&amp;quot;    &lt;br /&gt;appcmd site set /site.name:&amp;quot;Default Web Site&amp;quot; /logFile.logFormat:&amp;quot;Custom&amp;quot; &lt;/blockquote&gt;  &lt;p&gt;Now, we have just configured IIS to use ODBC logging for our default website. We still need to configure the required DSN name, table-name, username and password to do the ODBC logging. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Configuring ODBC logging parameters in ApplicationHost.config&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;After you&amp;#8217;ve followed &lt;a href="http://support.microsoft.com/kb/245243"&gt;this KB article&lt;/a&gt; to create database, table, and DSN, you need to make sure you configure ApplicationHost.config to contain the information. You need to configure those settings in &amp;lt;odbcLogging&amp;gt; node under &amp;lt;system.webServer&amp;gt;. Below is my sample configuration:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;lt;location path=&amp;quot;Default Web Site&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160; &amp;lt;system.webServer&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;odbcLogging dataSource=&amp;quot;ODBCLogging&amp;quot; tableName=&amp;quot;HTTPLog&amp;quot; userName=&amp;quot;Username&amp;quot; password=&amp;quot;mypassword&amp;#8221; /&amp;gt;&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/system.webServer&amp;gt;       &lt;br /&gt;&amp;lt;/location&amp;gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Below are the AppCmds to configure the above attributes for the site:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;appcmd set config &amp;quot;Default Web Site&amp;quot; /section:odbcLogging /dataSource:&amp;quot;ODBCLogging&amp;quot; /commit:appHost      &lt;br /&gt;appcmd set config &amp;quot;Default Web Site&amp;quot; /section:odbcLogging /tableName:&amp;quot;ODBCLogTable&amp;quot; /commit:appHost       &lt;br /&gt;appcmd set config &amp;quot;Default Web Site&amp;quot; /section:odbcLogging /userName:&amp;quot;Username&amp;quot; /commit:appHost       &lt;br /&gt;appcmd set config &amp;quot;Default Web Site&amp;quot; /section:odbcLogging /password: &amp;quot;mypassword&amp;quot; /commit:appHost &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Also, we do not support configuring ODBC logging feature in IIS using the SQL Native Client ODBC driver. You must use the SQL Server ODBC driver. You might want to take a look at this &lt;a href="http://support.microsoft.com/kb/931202"&gt;KB article&lt;/a&gt; on this. &lt;/p&gt;  &lt;p&gt;Hope this helps! Do post a comment if you have any questions on this. &lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2302607" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="IIS7" scheme="http://blogs.iis.net/rakkimk/archive/tags/IIS7/default.aspx" /><category term="Logging" scheme="http://blogs.iis.net/rakkimk/archive/tags/Logging/default.aspx" /></entry><entry><title>ASP.NET - Using the same encryption method used by ActiveDirectoryMembershipProvider to encrypt secret password answer and store it in AD</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/04/11/asp-net-using-the-same-encryption-method-used-by-activedirectorymembershipprovider-to-encrypt-secret-password-answer-and-store-it-in-ad.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/04/11/asp-net-using-the-same-encryption-method-used-by-activedirectorymembershipprovider-to-encrypt-secret-password-answer-and-store-it-in-ad.aspx</id><published>2008-04-12T00:26:29Z</published><updated>2008-04-12T00:26:29Z</updated><content type="html">&lt;p&gt;Okay, this is an interesting stuff. MembershipProvider automatically encrypts most of the sensitive information such as password, secret-question-password. What if you want to use the same encryption method yourself to encrypt data?  &lt;p&gt;Before continuing reading, You need to understand and keep in mind that your &amp;lt;machinekey&amp;gt; section is the one which would be used for the encryption / decryption by the MembershipProvider. &lt;strong&gt;If you change it after encryption, your decryption may fail.&lt;/strong&gt; So, please be careful while modifying anything on &amp;lt;machinekey&amp;gt; section in your web.config.  &lt;p&gt;I've just created a class inheriting from MembershipProvider. I've implemented all the methods of it (just a dummy implementation - VS would be more than happy to do that for you - if you find difficulty in this, write to me; I'll help you). I've also created another new method called EncryptMe which takes a string and returns me a string which is in fact the encrypted string. This method just gets the string in bytes with RNGCryptoServiceProvider and just call the function EncryptPassword of the MembershipProvider class to do the encryption.  &lt;p&gt;In fact, the EncryptPassword method is a protected method of the MembershipProvider class, and by using it, we have just achieved the same encryption which is used by the MembershipProvider class (which our ActiveDirectoryMembershipProvider also uses to encrypt your secret-password-answer). Since it is protected, you can't access it anywhere outside, but inside a derived class.  &lt;p&gt; &lt;div style="padding-right: 0px; padding-left: 0px; background: #808080; padding-bottom: 0px; margin-left: 4px; margin-right: 4px; padding-top: 0px"&gt; &lt;div style="border-right: #2e595c 1px solid; border-top: #2e595c 1px solid; background: #fff; left: -2px; border-left: #2e595c 1px solid; color: black; border-bottom: #2e595c 1px solid; position: relative; top: -2px"&gt; &lt;div style="border-right: blue 1px solid; border-top: blue 1px solid; background: #3f73b6; border-left: blue 1px solid; width: 100%; color: white; border-bottom: blue 1px solid"&gt;&lt;span style="width: 100%"&gt;Source of my EncryptMe Function&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;    &lt;/span&gt;&lt;span style="color: #2b91af"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; EncryptMe(&lt;/span&gt;&lt;span style="color: #2b91af"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; s)
    {
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;byte&lt;/span&gt;&lt;span style="color: #000000"&gt;[] bytes = System.Text.&lt;/span&gt;&lt;span style="color: #00ff00"&gt;Encoding&lt;/span&gt;&lt;span style="color: #000000"&gt;.Unicode.GetBytes(s);
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;byte&lt;/span&gt;&lt;span style="color: #000000"&gt;[] data = &lt;/span&gt;&lt;span style="color: #2b91af"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;byte&lt;/span&gt;&lt;span style="color: #000000"&gt;[0x10];
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Security.Cryptography.&lt;/span&gt;&lt;span style="color: #00ff00"&gt;RNGCryptoServiceProvider&lt;/span&gt;&lt;span style="color: #000000"&gt;().GetBytes(data);
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;byte&lt;/span&gt;&lt;span style="color: #000000"&gt;[] dst = &lt;/span&gt;&lt;span style="color: #2b91af"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;byte&lt;/span&gt;&lt;span style="color: #000000"&gt;[data.Length + bytes.Length];
        &lt;/span&gt;&lt;span style="color: #00ff00"&gt;Buffer&lt;/span&gt;&lt;span style="color: #000000"&gt;.BlockCopy(data, 0, dst, 0, data.Length);
        &lt;/span&gt;&lt;span style="color: #00ff00"&gt;Buffer&lt;/span&gt;&lt;span style="color: #000000"&gt;.BlockCopy(bytes, 0, dst, data.Length, bytes.Length);
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;byte&lt;/span&gt;&lt;span style="color: #000000"&gt;[] b = EncryptPassword(dst);
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #00ff00"&gt;Convert&lt;/span&gt;&lt;span style="color: #000000"&gt;.ToBase64String(b);
    }&lt;/PRE&lt; DIV&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Now, you can just store the encrypted string to the active directory property which you've mapped to the Secret-question-password. Check &lt;a href="http://support.microsoft.com/kb/555205"&gt;this knowledge base article&lt;/a&gt; which explains how to modify an attribute of an user in active directory. It just talks about the properties needed by the FTP user isolation, just modify the code to use your own attribute. &lt;/p&gt;
&lt;p&gt;Again, please make sure you do not alter your &amp;lt;machinekey&amp;gt; section which has all the information needed to encrypt and decrypt data. &lt;/p&gt;
&lt;p&gt;Hope this helps!&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2293285" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.iis.net/rakkimk/archive/tags/ASP.NET/default.aspx" /><category term="MembershipProvider" scheme="http://blogs.iis.net/rakkimk/archive/tags/MembershipProvider/default.aspx" /><category term="ActiveDirectoryMembershipProvider" scheme="http://blogs.iis.net/rakkimk/archive/tags/ActiveDirectoryMembershipProvider/default.aspx" /></entry><entry><title>ASP.NET - Enabling PasswordReset functionality when using ActiveDirectoryMembershipProvider</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/04/11/enabling-passwordreset-functionality-when-using-activedirectorymembershipprovider.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/04/11/enabling-passwordreset-functionality-when-using-activedirectorymembershipprovider.aspx</id><published>2008-04-11T22:59:00Z</published><updated>2008-04-11T22:59:00Z</updated><content type="html">&lt;P&gt;If you want to use ActiveDirectoryMembershipProvider on your website to manage users specially the password reset functionality, you will also need to create few attributes in the active directory schema for the "USER" object. You can check &lt;A href="http://msdn2.microsoft.com/en-us/library/ms998360.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms998360.aspx"&gt;this MSDN article&lt;/A&gt; to know more about this, but again, it doesn't list how to create the needed attributes, but it tells you what are all the attributes needed if you are considering "Password Reset" functionality. &lt;/P&gt;
&lt;P&gt;Firstly, ActiveDirectoryMembershipProvider does not support retrieving the password, but you can reset the password by providing secret-question, and secret-answer. You may also need to create few more attributes in the active directory schema associated with this. Below are those attributes:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Password Question - &lt;STRONG&gt;Unicode String&lt;/STRONG&gt; &lt;/LI&gt;
&lt;LI&gt;Password Answer - &lt;STRONG&gt;Unicode String&lt;/STRONG&gt; &lt;/LI&gt;
&lt;LI&gt;Failed Answer count - &lt;STRONG&gt;Integer&lt;/STRONG&gt; &lt;/LI&gt;
&lt;LI&gt;Last time at which the user supplied an invalid answer - &lt;STRONG&gt;Large Integer/Interval&lt;/STRONG&gt; &lt;/LI&gt;
&lt;LI&gt;Account locked out time - &lt;STRONG&gt;Large Integer/Interval&lt;/STRONG&gt; &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;These are the 5 new attributes which you need to add in the active directory schema for the "USER" object. I will explain how to add new attributes and associate them to an existing object. &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You need to first install the schema snap-in by registering schmmgmt.dll (&lt;STRONG&gt;regsvr32 schmmgmt.dll&lt;/STRONG&gt;) &lt;/LI&gt;
&lt;LI&gt;Now, open an MMC, and &lt;STRONG&gt;add "Active Directory Schema" snap-in&lt;/STRONG&gt; &lt;/LI&gt;
&lt;LI&gt;Expand the Active Directory Schema, and right click on Attribute, and select &lt;STRONG&gt;"Create Attribute"&lt;/STRONG&gt; &lt;/LI&gt;
&lt;LI&gt;Enter the common name, LDAP name, other fields for the attribute you are creating. For example, "PasswordQuestion" - this would be having its type as &lt;STRONG&gt;Unicode String. &lt;/STRONG&gt;See the above list of attributes and its types appropriately. If Integer, enter minimum/maximum values too. &lt;/LI&gt;
&lt;LI&gt;For the OID, you need to check &lt;A href="http://msdn2.microsoft.com/en-us/library/ms677620.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms677620.aspx"&gt;this MSDN article&lt;/A&gt;. &lt;/LI&gt;&lt;/OL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/a9408e504f9b_13E3B/image_2.png" mce_href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/a9408e504f9b_13E3B/image_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=391 alt=image src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/a9408e504f9b_13E3B/image_thumb.png" width=390 border=0 mce_src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/a9408e504f9b_13E3B/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now follow the above steps to create all the 5 attributes which are needed. After creating these attributes, we need to attach them to the "USER" object. &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;In the same MMC, Expand &lt;STRONG&gt;"CLASSES" &lt;/STRONG&gt;and select &lt;STRONG&gt;user &lt;/STRONG&gt;object. &lt;/LI&gt;
&lt;LI&gt;Right click on &lt;STRONG&gt;user&lt;/STRONG&gt; and select properties &lt;/LI&gt;
&lt;LI&gt;Go to its attributes tab, and click &lt;STRONG&gt;Add&lt;/STRONG&gt; &lt;/LI&gt;
&lt;LI&gt;Select the attributes that you've created one by one and click on OK &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;That's it. Now, your user object would have all those attributes, and you can store values using any method you like. If you create an user using CreateUser wizard control, it would populate and store the values of the secret-question, answer automatically. ActiveDirectoryMembershipProvider would take care of storing, retrieving values of these attributes itself, you no need to program anything for them. &lt;/P&gt;
&lt;P&gt;But, there would be some situation the users have been already created, but you need to attach these attributes to them. Follow the above methods to add attributes to the &lt;STRONG&gt;user &lt;/STRONG&gt;object. And, now open the particular user's properties in ADSIEDIT.msc, and add values to them. &lt;/P&gt;
&lt;P&gt;After following all the above steps, follow the other steps mentioned in &lt;A href="http://msdn2.microsoft.com/en-us/library/ms998360.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms998360.aspx"&gt;this article&lt;/A&gt; to configure your web.config sections to map the attributes you've created in AD. &lt;/P&gt;
&lt;P&gt;NOTE: Password-answer is the only one attribute out of these 5 which would be stored in an encrypted format. &amp;lt;machinekey&amp;gt; section would be used for the encryption of this, if you create an user using the CreateUser wizard. But, if you have already created the user in the AD, and you want to just store the secret-question and password, you may want to check my next blog where I'll explain how to use the same encryption method used by the MembershipProvider to store the secret-password in the active directory for the user. &lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2293215" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.iis.net/rakkimk/archive/tags/ASP.NET/default.aspx" /><category term="MembershipProvider" scheme="http://blogs.iis.net/rakkimk/archive/tags/MembershipProvider/default.aspx" /></entry><entry><title>IIS7 - Configure Throttling for your documents (any MIME type) and save Bandwidth costs</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/04/04/iis7-configure-throttling-for-your-documents-any-mime-type-and-save-bandwidth-costs.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/04/04/iis7-configure-throttling-for-your-documents-any-mime-type-and-save-bandwidth-costs.aspx</id><published>2008-04-04T11:23:23Z</published><updated>2008-04-04T11:23:23Z</updated><content type="html">&lt;p&gt;Do you have a high traffic site where you have a lot of WMV/AVI/FLV/PDF documents (or any other MIME type) where your maximum bandwidth of the site is utilized? Do you ever think where majority of the bandwidth would go? Most of the users do not completely watch the video or listen to audio, or do not read the complete PDF file (or any progressive download document). Assume that they just watch for 5 minutes of your 1 hour long Flash Video (.flv). How much of your bandwidth (for download) would be used for this? You should try answering this question yourself. &lt;/p&gt;  &lt;p&gt;But, you will see a significant reduction in your bandwidth cost, if you start using this &lt;a href="http://blogs.iis.net/vsood/archive/2008/03/14/bit-rate-throttling-is-now-released.aspx"&gt;Bitrate Throttling Module&lt;/a&gt;. It would be configured for any video/audio file types, and in fact for any MIME types such as .PDF, .DOC, etc. &lt;/p&gt;  &lt;p&gt;I would explain here how to configure throttling setting specifically for PDF files. &lt;/p&gt;  &lt;p&gt;In the IIS Manager, select your web site, and select &amp;quot;Bit Rate Throttling&amp;quot; under Media Services. First of all, make sure that the bandwidth throttling is enabled in the site.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7ConfigureThrottlingforyourdocumentsa_EB92/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 5px; border-right-width: 0px" height="244" alt="image" src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7ConfigureThrottlingforyourdocumentsa_EB92/image_thumb.png" width="204" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now, Right click on the pane and select &amp;quot;Add Throttle Setting...&amp;quot; or select the same from the &amp;quot;Actions Pane&amp;quot;. Type &amp;quot;application/pdf&amp;quot; as the MIME type, and enter &amp;quot;Fast Start&amp;quot; and &amp;quot;Throttle rate&amp;quot; values.&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7ConfigureThrottlingforyourdocumentsa_EB92/image_8.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="482" alt="image" src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7ConfigureThrottlingforyourdocumentsa_EB92/image_thumb_3.png" width="444" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You should see bitrate throttling already added to major media files like .asf, .avi, .flv, .mov, .wmv, etc.,. I'm sure this feature in IIS7 would help you saving bandwidth costs for hosting media files, or any large documents. &lt;/p&gt;  &lt;p&gt;Here are the download links:&lt;/p&gt;  &lt;li&gt;   &lt;p&gt;&lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1640"&gt;http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1640&lt;/a&gt; =&amp;gt; 32-bit&lt;/p&gt; &lt;/li&gt;  &lt;li&gt;   &lt;p&gt;&lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1641"&gt;http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1641&lt;/a&gt; =&amp;gt; 64-bit&lt;/p&gt;    &lt;p&gt;Here are some learn.iis.net documents on this module:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;       &lt;p&gt;&lt;a href="http://go.microsoft.com/?LinkID=7439973"&gt;Bit Rate Throttling Setup Walkthrough&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://go.microsoft.com/?LinkID=7439975"&gt;Bit Rate Throttling Configuration Walkthrough&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://go.microsoft.com/?LinkID=7439974"&gt;Bit Rate Throttling Extensibility Walkthrough&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;   &lt;/ul&gt; &lt;/li&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2276478" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author></entry><entry><title>IIS7 - Administration Pack - technical preview released</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/03/20/iis7-administration-pack-technical-preview-released.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/03/20/iis7-administration-pack-technical-preview-released.aspx</id><published>2008-03-21T03:05:00Z</published><updated>2008-03-21T03:05:00Z</updated><content type="html">&lt;p&gt;Here are the links to download the new IIS7 admin pack - technical preview version:&lt;/p&gt; &lt;div class="postsub"&gt;&lt;li&gt;&lt;a href="http://iis.net/downloads/default.aspx?tabid=34&amp;amp;i=1646&amp;amp;g=6"&gt;Administration Pack for IIS 7.0 (x86)&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://iis.net/downloads/default.aspx?tabid=34&amp;amp;i=1647&amp;amp;g=6"&gt;Administration Pack for IIS 7.0 (x64)&lt;/a&gt;  &lt;p&gt;This comes with a lot of features which would make life simpler for the web administrators. Below are few of them:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Configuration Editor&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This
gives you an UI way of directly editing any of your configuration
present in your applicationHost.config file; and this is available for
administrators only, and you know why! &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_12.png"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_thumb_5.png" style="border-width: 0px;" alt="image" border="0" height="407" width="458"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;IIS Reports&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;It
was an UI extension released a while ago, and now a part of the admin
pack. An awesome tool which uses LogParser to create charts, diagrams,
reports about various data stored in the log files. You need to have
LogParser installed to use this one. You can download LogParser from &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;amp;displaylang=en"&gt;here&lt;/a&gt;. &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_14.png"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_thumb_6.png" style="border-width: 0px;" alt="image" border="0" height="437" width="468"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Database Manager&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This
gives you an UI to manage the existing database connections inside the
IIS7 manager itself. you can edit tables, query, et al. The database
connections are pulled from those are added through "Connection
Strings" UI module under ASP.NET in IIS7 manager. &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_18.png"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_thumb_8.png" style="border-width: 0px;" alt="image" border="0" height="118" width="466"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Request Filtering UI Module&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Here
comes my most awaited UI module with this admin pack. In fact I started
writing one, but stopped after knowing that this one is coming. Pretty
easy way to add Request Filtering rules. &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_20.png"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_thumb_9.png" style="border-width: 0px;" alt="image" border="0" height="222" width="463"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;FastCGI settings UI Module&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Another UI module to change the FastCGI settings. &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_22.png"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_thumb_10.png" style="border-width: 0px;" alt="image" border="0" height="532" width="466"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;.NET Error Pages&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The UI module which can be used to add .NET error pages directly into the configuration file.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_24.png"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_thumb_11.png" style="border-width: 0px;" alt="image" border="0" height="335" width="283"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;.NET Authorization Rules&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Finally one for the ASP.NET Authorization rules.&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_26.png"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/rakkimk/WindowsLiveWriter/IIS7AdministrationPacktechnicalpreviewre_766C/image_thumb_12.png" style="border-width: 0px;" alt="image" border="0" height="536" width="454"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I'm
sure these modules will make the life of an administrator much easier,
especially the "Request Filtering" one. It would have been difficult to
use all the available features of this feature without this UI module
since you need to know the schema of the &amp;lt;requestFiltering&amp;gt;
section to know what are the configurations available, and what are the
different attributes. &lt;/p&gt; &lt;p&gt;Here are some learning documents on this tool. &lt;/p&gt; &lt;blockquote&gt; &lt;li&gt; &lt;h5&gt;&lt;a href="http://learn.iis.net/page.aspx/404/overview-of-functionality/"&gt;Overview of Functionality&lt;/a&gt;&lt;/h5&gt; &lt;/li&gt;&lt;li&gt; &lt;h5&gt;&lt;a href="http://learn.iis.net/page.aspx/411/iis-reports-available/"&gt;IIS Reports Available&lt;/a&gt;&lt;/h5&gt; &lt;/li&gt;&lt;li&gt; &lt;h5&gt;&lt;a href="http://learn.iis.net/page.aspx/412/using-iis-reports-remotely/"&gt;Using IIS Reports Remotely&lt;/a&gt;&lt;/h5&gt; &lt;/li&gt;&lt;li&gt; &lt;h5&gt;&lt;a href="http://learn.iis.net/page.aspx/415/install-the-administration-pack/"&gt;Install the Administration Pack&lt;/a&gt;&lt;/h5&gt; &lt;/li&gt;&lt;li&gt; &lt;h5&gt;&lt;a href="http://learn.iis.net/page.aspx/416/basics-of-database-manager/"&gt;Basics of Database Manager&lt;/a&gt;&lt;/h5&gt; &lt;/li&gt;&lt;li&gt; &lt;h5&gt;&lt;a href="http://learn.iis.net/page.aspx/417/using-config-editor-generate-scripts/"&gt;Using Config Editor: Generate Scripts&lt;/a&gt;&lt;/h5&gt; &lt;/li&gt;&lt;li&gt; &lt;h5&gt;&lt;a href="http://learn.iis.net/page.aspx/418/editing-collections-with-configuration-editor/"&gt;Editing Collections with Configuration Editor&lt;/a&gt;&lt;/h5&gt; &lt;/li&gt;&lt;li&gt; &lt;h5&gt;&lt;a href="http://learn.iis.net/page.aspx/419/editing-collections-using-configuration-editor-complex-sections/"&gt;Editing Collections using Configuration Editor: Complex Sections&lt;/a&gt;&lt;/h5&gt;&lt;/li&gt;&lt;/blockquote&gt; &lt;p&gt;Kudos to the development team! &lt;/p&gt;&lt;/li&gt;&lt;/div&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2246544" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="IIS7" scheme="http://blogs.iis.net/rakkimk/archive/tags/IIS7/default.aspx" /><category term="Admin Pack" scheme="http://blogs.iis.net/rakkimk/archive/tags/Admin+Pack/default.aspx" /></entry><entry><title>IIS7 - Running ASP.NET 1.1 applications</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/03/20/iis7-running-asp-net-1-1-applications.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/03/20/iis7-running-asp-net-1-1-applications.aspx</id><published>2008-03-20T09:34:00Z</published><updated>2008-03-20T09:34:00Z</updated><content type="html">&lt;p&gt;There a lot of other articles available in iis.net which explains how to run an ASP.NET application on IIS7. Here are those steps:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Download .NET Fx 1.1 from &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=A8F5654F-088E-40B2-BBDB-A83353618B38&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=A8F5654F-088E-40B2-BBDB-A83353618B38&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=A8F5654F-088E-40B2-BBDB-A83353618B38&amp;amp;displaylang=en&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Download .NET Fx 1.1 SP1 from &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=A8F5654F-088E-40B2-BBDB-A83353618B38&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=A8F5654F-088E-40B2-BBDB-A83353618B38&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=A8F5654F-088E-40B2-BBDB-A83353618B38&amp;amp;displaylang=en&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Install both of them &lt;/li&gt;    &lt;li&gt;Allow ASP.NET 1.1 in the ISAPI/CGI Restrictions &lt;/li&gt;    &lt;li&gt;Make sure you run your application pool in a 32-bit mode + v1.1 + classic mode &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Your application pool's configuration in applicationHost.config should look like below:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="ASP.NET 1.1" enable32BitAppOnWin64="true" managedRuntimeVersion="v1.1" managedPipelineMode="Classic" autoStart="true" /&amp;gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Below are the commands using appcmd.exe tool which would do this.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; appcmd apppool set /apppool.name:"ASP.NET 1.1" /enable32BitAppOnWin64:true      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; appcmd apppool set /apppool.name:"ASP.NET 1.1" /managedRuntimeVersion="v1.1"       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; appcmd apppool set /apppool.name:"ASP.NET 1.1" /managedPipelineMode:"Classic"       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; appcmd apppool set /apppool.name:"ASP.NET 1.1" /autoStart:true&amp;nbsp; &lt;b&gt;(optional)&lt;/b&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now, comes an interesting UI module. You can write a UI module to do whatever you want. I felt like writing one today, and thought of writing one for the above. Below is how it looks:&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7RunningASP.NET1.1applications_D36D/image_2.png" mce_href="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7RunningASP.NET1.1applications_D36D/image_2.png"&gt;&lt;img src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7RunningASP.NET1.1applications_D36D/image_thumb.png" style="border-width: 0px;" alt="image" mce_src="http://blogs.iis.net/blogs/rakkimk/WindowsLiveWriter/IIS7RunningASP.NET1.1applications_D36D/image_thumb.png" border="0" height="260" width="449"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;p&gt;Here is the link for the DLL:&lt;/p&gt;  &lt;p&gt;&lt;iframe src="http://cid-d51bd0fea1143bbd.skydrive.live.com/embedrow.aspx/MSDNBlogAttachments/IIS7Fx11Advisor.dll" style="border: 1px solid rgb(221, 229, 233); margin: 3px; padding: 0px; width: 240px; height: 26px; background-color: rgb(255, 255, 255);" marginwidth="0" marginheight="0" mce_src="http://cid-d51bd0fea1143bbd.skydrive.live.com/embedrow.aspx/MSDNBlogAttachments/IIS7Fx11Advisor.dll" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;p&gt;To add this module in your IIS 7 manager follow the below steps: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Download the &lt;a href="http://wbnpjg.bay.livefilestore.com/y1prMF2JkArKz103FG7okaINhkTR09xP69qZD1OVzr2p6CDeY-GEXaiXKDrCYfNtkp6pNV8LWN5NpM0gCOERMYOx_Vv7A4UXUvi/IIS7Fx11Advisor.dll" mce_href="http://wbnpjg.bay.livefilestore.com/y1prMF2JkArKz103FG7okaINhkTR09xP69qZD1OVzr2p6CDeY-GEXaiXKDrCYfNtkp6pNV8LWN5NpM0gCOERMYOx_Vv7A4UXUvi/IIS7Fx11Advisor.dll"&gt;IIS7Fx11Advisor.dll&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;From inetsrv folder Drag and Drop the IIS7Fx11Advisor.dll into the Global Assembly Cache (C:\Windows\assembly) or use GacUtil -i IIS7Fx11Advisor.dll to install it to the GAC. &lt;/li&gt;    &lt;li&gt;Under File Menu, browse for the file %WinDir%\System32\InetSrv\config\Administration.config. &lt;/li&gt;    &lt;li&gt;Search for the &amp;lt;moduleProviders&amp;gt; section and add the following      &lt;blockquote&gt;       &lt;p&gt;&amp;lt;add name="IIS7Fx11Advisor" type="IIS7Fx11Advisor.MyModuleProvider, IIS7Fx11Advisor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=db9daa3d2ea5f6fd" /&amp;gt;&lt;/p&gt;     &lt;/blockquote&gt;   &lt;/li&gt;    &lt;li&gt;Search for the &amp;lt;modules&amp;gt; section and add the following      &lt;blockquote&gt;       &lt;p&gt;&amp;lt;add name="IIS7Fx11Advisor" /&amp;gt;&lt;/p&gt;     &lt;/blockquote&gt;   &lt;/li&gt;    &lt;li&gt;Open Inetmgr and You will see the module listed in your IIS 7 Manager if you would’ve followed the above steps properly. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Let me know if this helps you!&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2244598" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="IIS7" scheme="http://blogs.iis.net/rakkimk/archive/tags/IIS7/default.aspx" /></entry><entry><title>AJAX - Calling PageMethods defined on a UserControl</title><link rel="alternate" type="text/html" href="http://blogs.iis.net/rakkimk/archive/2008/03/20/ajax-calling-pagemethods-defined-on-a-usercontrol.aspx" /><id>http://blogs.iis.net/rakkimk/archive/2008/03/20/ajax-calling-pagemethods-defined-on-a-usercontrol.aspx</id><published>2008-03-20T08:19:42Z</published><updated>2008-03-20T08:19:42Z</updated><content type="html">&lt;p&gt;I recently worked with one of my customer, asking for help to migrate his application to AJAX.NET. He had some UserControls which had few methods which needs to be called (ScriptMethods). &lt;/p&gt;  &lt;p&gt;If you have a [ScriptMethod] defined in your user control, you cannot call that from your .aspx page using PageMethods.functionname(). Only ScriptMethods defined in the same .aspx page can be called. &lt;/p&gt;  &lt;p&gt;A simple workaround would be to have another page method inside the page which in-turn would call the ScriptMethod on the UserControl. Remember all the methods should be public static to be used as a PageMethod.&lt;/p&gt;  &lt;p&gt;Below is an example:&lt;/p&gt;  &lt;p&gt;UserControl's ScriptMethod:&lt;/p&gt;  &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;   &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; [WebMethod]&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; [ScriptMethod(UseHttpGet = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;)]&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; MyUserControlPageMethod()&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #006080"&gt;&amp;quot;Hello from MyUserControlPageMethod&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;ASPX page:&lt;/p&gt;

&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;
  &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:ScriptManager&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ScriptManager1&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;EnablePageMethods&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ScriptMode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:ScriptManager&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;uc1:WebUserControl&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;WebUserControl1&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;language&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt;         &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;      &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; callbackFunction(result) {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;         $get(&lt;span style="color: #006080"&gt;&amp;quot;WebUserControl1_Label1&amp;quot;&lt;/span&gt;).innerText = result;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;      }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;      &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;      &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; CallUserControlPageMethod()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;      {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         PageMethods.ForwardingToUserControlPageMethod(callbackFunction);           &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;      }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     &lt;/pre&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;In ASPX .cs file:&lt;/p&gt;

&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;
  &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; [WebMethod]&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; [ScriptMethod]&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; ForwardingToUserControlMethod(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; ddlValue)&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; WebUserControl.MyUserControlMethod(ddlValue);&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Hope this helps!&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2244496" width="1" height="1"&gt;</content><author><name>rakkimk</name><uri>http://blogs.iis.net/members/rakkimk.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.iis.net/rakkimk/archive/tags/ASP.NET/default.aspx" /><category term="AJAX" scheme="http://blogs.iis.net/rakkimk/archive/tags/AJAX/default.aspx" /></entry></feed>