Click here to Skip to main content
14,976,314 members
Articles / DevOps / Deployment
Technical Blog
Posted 2 Dec 2011


17 bookmarked

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

Rate me:
Please Sign up or sign in to vote.
5.00/5 (16 votes)
3 Dec 2011CPOL5 min read
How to: ASP.NET 4.0 Routing and Ext.NET.


A few days ago, I got a problem during the deployment of an ASP.NET 4.0 website on IIS7 with default app pool. The website includes ASP.NET 4 routing features and in the website. But when I tried to access the enabled pages, I found nothing over there, just a blank page. The configuration was as follows:

Setup and Configuration 

For 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
  2. Unzip the contents of the zip file into a new directory.
  3. Open the directory and copy the following five files to your project's /bin directory:
    1. Ext.Net.dll
    2. Ext.Net.Utilities.dll
    3. Ext.Net.xml
    4. Newtonsoft.Json.dll
    5. Newtonsoft.Json.xml
  4. In 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 the References tab on the left. You should see all the references in the center.
  10. Click the Add button and then the Browse tab.
  11. Browse to your project's /bin directory (where you copied the DLLs to) and select the three DLLs and click OK.
  12. Under Imported namespaces, scroll to the bottom and click on the checkboxes for the following:
    1. Ext
    2. Ext.Net
    3. Ext.Net.Utilities
    4. Newtonsoft
    5. 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 Studio. We do this so items are displayed within your toolbox (if it is 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 and 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 two 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 website or web application for routing. You first need to add a reference to the System.Web.Routing assembly. The SP1 installation for .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 are 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 worked fine after removing routing related code from the site. But we need both of them to work together.

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


The solution is as follows:

  • Remove httpHandlers and httpModules from system.web
  • Configure system.webServer like below:
  • XML
    <modules runAllManagedModulesForAllRequests="true">
    <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net"/>
    <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net"/>
  • Configure global.asax
  • C#
    // this is because I used the in the admin module 

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

The reasons we use

  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 uneventful (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 like a charm.
  4. Excellent UI with a lot of really helpful examples.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Monjurul Habib
Software Developer (Senior)
Singapore Singapore
A life-long-learner, maker and soft music fan. Likes building things to solve problems. Years of successful records serving mid and large scale .NET applications in domestic and international client environment. Expertise in different areas of software development life cycles and Software Architecture.

Always looks for new technology and loves to get hands dirty Smile | :)

Comments and Discussions

GeneralMy vote of 5 Pin
Member 105108224-Mar-13 3:08
professionalMember 105108224-Mar-13 3:08 
GeneralRe: My vote of 5 Pin
Monjurul Habib4-Mar-13 4:54
professionalMonjurul Habib4-Mar-13 4:54 
GeneralMy vote of 5 Pin
Member 1051082221-Feb-13 0:16
professionalMember 1051082221-Feb-13 0:16 
GeneralMy vote of 5 Pin
ISuryansyah22-May-12 0:43
professionalISuryansyah22-May-12 0:43 
GeneralRe: My vote of 5 Pin
Monjurul Habib22-May-12 9:37
professionalMonjurul Habib22-May-12 9:37 
GeneralMy vote of 5 Pin
Member 1051082210-Feb-12 16:52
professionalMember 1051082210-Feb-12 16:52 
GeneralRe: My vote of 5 Pin
Monjurul Habib26-Feb-12 0:05
professionalMonjurul Habib26-Feb-12 0:05 
GeneralMy vote of 5 Pin
chrisuae14-Dec-11 1:00
Memberchrisuae14-Dec-11 1:00 
GeneralRe: My vote of 5 Pin
Monjurul Habib14-Dec-11 4:59
professionalMonjurul Habib14-Dec-11 4:59 
GeneralMy vote of 5 Pin
cisjackie10-Dec-11 20:24
Membercisjackie10-Dec-11 20:24 
GeneralRe: My vote of 5 Pin
Monjurul Habib10-Dec-11 20:25
professionalMonjurul Habib10-Dec-11 20:25 
GeneralMy vote of 5 Pin
Humayun Kabir Mamun5-Dec-11 19:01
MemberHumayun Kabir Mamun5-Dec-11 19:01 
GeneralRe: My vote of 5 Pin
Monjurul Habib5-Dec-11 19:02
professionalMonjurul Habib5-Dec-11 19:02 
QuestionStill getting problem Pin
Rubaba3-Dec-11 6:00
MemberRubaba3-Dec-11 6:00 
AnswerRe: Still getting problem Pin
Monjurul Habib3-Dec-11 6:56
professionalMonjurul Habib3-Dec-11 6:56 
GeneralRe: Still getting problem Pin
Monjurul Habib4-Dec-11 7:22
professionalMonjurul Habib4-Dec-11 7:22 
GeneralRe: Still getting problem Pin
Rubaba10-Dec-11 4:39
MemberRubaba10-Dec-11 4:39 
GeneralRe: Still getting problem Pin
Monjurul Habib10-Dec-11 20:23
professionalMonjurul Habib10-Dec-11 20:23 
GeneralMy vote of 5 Pin
Mahbub_Hasan_Aiub2-Dec-11 18:59
MemberMahbub_Hasan_Aiub2-Dec-11 18:59 
GeneralRe: My vote of 5 Pin
Monjurul Habib2-Dec-11 19:59
professionalMonjurul Habib2-Dec-11 19:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.