IIS 7 deployment : ASP.NET 4.0 Routing and Ext.NET

Few days ago, i got a problem during deployment an ASP.NET 4.0 website on IIS7 with default app pool. The website includes asp.net 4 routing feature and ext.net in the website. But when tried to access the ext.net enable pages, we found nothing over there, it was just a blank page. The configuration was as follows:

For ext.net Install and Setup i used the following steps for visual studio 2010 sp1:

1) To start you will need to download the Ext.Net latest version from http://www.ext.net/.
2) Unzip the contents of the zip file into a new directory.
3) Open the directory and copy the following five files to your projects /bin directory:

a) Ext.Net.dll b) Ext.Net.Utilities.dll c) Ext.Net.xml d) Newtonsoft.Json.dll e) Newtonsoft.Json.xml

4 ) In the solution explorer make sure the view all files button is selected.
5) Expand the /bin directory to display all files and Click the refresh button at the top
6) select each of the new files you just added to the /bin directory (shift + click)
7) Right click and choose “Include in Project”

8) In solution Explorer Click the properties button for your project (top left button).
9) Click on References tab on the left. You should see all references in the center.
10) Click the Add button and then the browse tab.
11) Browse to your projects /bin directory (were you copied the DLL’s to) and select the 3 DLL’s and click ok.
12) Under Imported namespaces scroll to the bottom and click on the checkboxes for the following:

a) Ext b)Ext.Net c) Ext.Net.Utilities d) Newtonsoft e) Newtonsoft.Json

13) Open your web.config file. You will need to add the following to your config file.

<section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
<add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
<add name="DirectRequestModule" type="Ext.Net.DirectRequestModule,Ext.Net" />
<validation validateIntegratedModeConfiguration="false"/>
<add name="DirectRequestModule" preCondition="managedHandler"
type="Ext.Net.DirectRequestModule, Ext.Net" />
<add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler" />

Now follow the steps to add Ext.Net in your visual studio toolbox:

# Open a .aspx file to exit in visual studios. We do this so items are displayed within your toolbox (if its a .vb, .cs, etc it will not display items).
# Next click on your toolbar and click add tab. Name this tab something (Ext.Net)
# Right click under this tab click choose items
# Click the Browse button under “.NET Framework Components”
# If no errors are displayed you should now see all the components under the new tab.

Before you begin I would suggest doing a Build Clean and Rebuild to confirm all the new changes are set.
To use Ext.Net within your page requires 2 changes to an existing page. A register tag and the resourcemanager tag.

At the top of your page (under the page directive) add the following which will give you access to the Ext.Net DLL :

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

Next find your BODY tag and add the following:

<ext:ResourceManager ID="ResourceManager1" runat="server" />

And For routing : configure an ASP.NET Web site or Web application for routing, you first need to add a reference to the System.Web.Routing assembly. The SP1 installation for the .NET Framework 3.5 will install this assembly into the global assembly cache, and you can find the assembly inside the standard “Add Reference” dialog box. You’ll also need to configure the routing module into the ASP.NET pipeline. The routing module is a standard HTTP module. For IIS 6.0 and earlier and for the Visual Studio Web development server, you install the module using the <httpModules> section of web.config, as you see here:

<add name=”RoutingModule”
Version=, Culture=neutral,

URL rewriting implementations typically perform their work during the BeginRequest event, which is the earliest event to fire during a request. With URL routing, the route matching and selection of a route handler occurs during the PostResolveRequestCache stage, which is after the authentication, authorization, and cache lookup stages of processing. I will need to revisit the implications of this event timing later in the column.

To run a Web site with routing in IIS 7.0, you need two entries in web.config. The first entry is the URL routing module configuration, which is found in the <modules> section of <system.webServer>. You also need an entry to handle requests for UrlRouting.axd in the <handlers> section of <system.webServer>. Both of these entries as follows:

<modules runAllManagedModulesForAllRequests=”true”>

<add name=”UrlRoutingModule”
System.Web.Routing, Version=,
PublicKeyToken=31BF3856AD364E35″ />

<add name=”UrlRoutingHandler”
verb=”*” path=”UrlRouting.axd”
System.Web, Version=, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a” />


The runAllManagedModulesForAllRequests attribute requires a value of true if you want to use the extensionless URLs as I’ve done in this sample. Also, it might seem strange to configure an HTTP handler for UrlRouting.axd. This is a small workaround that the routing engine requires in order for routing to work under IIS 7.0. The UrlRouting module actually rewrites the incoming URL to ~/UrlRouting.axd, which will rewrite the URL back to the original, incoming URL.


The problem was ext.net worked fine after removing routing related code from the site. But we need both of them work together.

Then we we tried to find a workaround for that problem and got few links on google, we compiled them and apply one by one and finally we got the solution to use both of them together.


The solution was as follows:

1) Remove httpHandlers and httpModules from system.web
2) Configure system.webServer like the following:

<modules runAllManagedModulesForAllRequests=”true”>
<add name=”DirectRequestModule” type=”Ext.Net.DirectRequestModule, Ext.Net”/>
<add name=”DirectRequestModule” type=”Ext.Net.DirectRequestModule, Ext.Net”/>

3) Configure global.asax:
RouteTable.Routes.Ignore("admin/{*pathInfo}");// this is because we used the ext.net in the admin module

That was all and the website is running without any conflict.

The reasons we use ext.net :

1) It has a *simple* design model that is followed consistently throughout the code
2) The upgrade path from v.0.33 to v.1.1 to v.2.02 was smooth and mostly uneventfull (i.e. it worked as it should!) with the exception of the grid component that was really a hard nut to crack (for the upgrades that is)
3) flexibility over choosing the best combination of extsjs+glue+custom code or full extsjs+custom code. For example, for a long time although I used extjs for almost everything I relied on YUI’s XHR calls for actually doing AJAX stuff and it worked as a charm
3) excellent UI with a lot of really helpfull examples