Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So you have a class that implements <code>IHttpHandler</code> called: <code>MyHandler</code> and it's in the namespace <code>Example</code>, you need to make the following entries in the site's <code>Web.Config</code> in the <a href="http://msdn.microsoft.com/en-us/library/bya7fh0a%28v=VS.80%29.aspx" rel="nofollow">httpHandlers</a> section:</p> <pre><code>&lt;httpHandlers&gt; &lt;add verb="*" path="*" type="Example.MyHandler"/&gt; &lt;/httpHandlers&gt; </code></pre> <p>Since this redirects all URLs for your web site/application to your handler you have to consider how to serve static content (imgs, scripts, style sheets etc). One way is to store such static content in a consistent URL like <code>http://example.com/static/...</code>, you can then set your handlers as such:</p> <pre><code>&lt;httpHandlers&gt; &lt;add verb="*" path="*" type="Example.MyHandler"/&gt; &lt;add verb="GET,HEAD" path="static/*" type="System.Web.StaticFileHandler" /&gt; &lt;/httpHandlers&gt; </code></pre> <p>For your local dev webserver (embedded in Visual Studio) this is all that's needed. For IIS, you also need to tell IIS how to deal with these URLS (since the server first analyses a request to decide where to send it - including whether to send it to ASP.NET or some other extension).</p> <ul> <li>Open: IIS Manager -> </li> <li>Section: Websites -> </li> <li>Right click on your website -> </li> <li>Option: Properties -> </li> <li>Tab: Home Directoy -> </li> <li>Button: [Configuration...] -> </li> <li>Tab: Mappings -> </li> <li>Section: "Wildcard application maps (order of implementation):" -></li> <li>Button: [Insert...] -> </li> <li>Executable: "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" (or whichever version of the .NET runtime your handler uses) -> </li> <li>Uncheck "Verify that file exists" -></li> <li>Button: [OK]</li> </ul> <p>Now both IIS and ASP.NET know how to deal with your URLS. </p> <p>The above approach means when requesting static files, ASP.NET is actually serving the files, not IIS - which leads to a few disadvantages (discussed <a href="http://bytes.com/topic/asp-net/answers/553719-system-web-staticfilehandler-has-limit" rel="nofollow">here</a>). You can override this behaviour (disable wildcard mapping from the static directory) by switching the directory to an application (in IIS Manager), removing the wildcard mapping statement (added above) and switching it back from an application. Voilà - static files are handled by IIS without pestering your ASP.NET.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload