Solved

Url Routing in IIS 7 hosting environment : ASP.NET

Posted on 2011-02-25
2
1,103 Views
Last Modified: 2013-12-14
Hi

I am trying to implement ASP.NET URL routing using the System.Web.Routing. And this seems to work fine on my localhost however when I go live I am getting an IIS 7's 404 error (File not found). FYI the hosting uses Windows Server 2008 IIS7 and It has .NET Framework 3.5 SP1

I think this is making some difference in handling the routing mechanism. But I am not able to figure out whats exactly happening.

In Web.Config HttpModules  i have added the below setting

 <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Can anybody suggest how to resolve this.


 
0
Comment
Question by:GouthamAnand
2 Comments
 
LVL 13

Accepted Solution

by:
agarwalrahul earned 250 total points
ID: 34978822
Code:

In the application's Web.config file, add the ASP.NET routing assembly to the assemblies element, as shown in the following example:

<add assembly="System.Web.Routing, Version=3.5.0.0,
  Culture=neutral,
  PublicKeyToken=31BF3856AD364E35"/>

If the application runs under IIS 6.0 or IIS 7.0 Classic mode, add the UrlRoutingModule class to the httpModules element, as shown in the following example:

<httpModules>
  <add name="UrlRoutingModule"
       type="System.Web.Routing.UrlRoutingModule,
             System.Web.Routing,
             Version=3.5.0.0,
             Culture=neutral,
             PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
If the application runs under IIS 7.0 Integrated mode, add the UrlRoutingModule class to the modules element, as shown in the following example:

<system.webServer>
  <modules>
    <remove name="UrlRoutingModule" />
    <add name="UrlRoutingModule"
         type="System.Web.Routing.UrlRoutingModule,
               System.Web.Routing,
               Version=3.5.0.0,
               Culture=neutral,
               PublicKeyToken=31BF3856AD364E35"/>
  </modules>
</system.webServer>
If the application runs under IIS 7.0 Integrated mode, add the UrlRoutingHandler class to the handlers element as shown in the following example:

<system.webServer>
  <handlers>
    <add name="UrlRoutingHandler"
         preCondition="integratedMode"
         verb="*"
         path="UrlRouting.axd"
         type="System.Web.HttpForbiddenHandler,
               System.Web, Version=2.0.0.0,
               Culture=neutral,
               PublicKeyToken=b03f5f7f11d50a3a" />
  </handlers>
</system.webServer>


also read link page for reference

http://msdn.microsoft.com/en-us/library/cc668202.aspx
0
 

Author Closing Comment

by:GouthamAnand
ID: 34980255
Thank for a timely reply. It is working fine in the server enviroment.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question