IIS7 ASP Routing not working on live server

We had an issue at work the other day where one of the developers was having an issue with asp routing in IIS7. It was the first time this particular server was asked to run a .net 4 website so naturally some fine tuning was required. When we tried to navigate to the webpage the following error appeared: 403: Access Permission Denied

I thought this looked odd as all permissions were applied correct and the webpage in question was coming up for us when we included it's extension. I took a look at the web.config file and noticed the rule to use asp routing was missing so we added that:

         
    <modulesrunAllManagedModulesForAllRequests="true">
        <removename="UrlRoutingModule"/>
        <addname="UrlRoutingModule"type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    

However, this didn't fix our issue. I was puzzled and spent a further 30mins exploring all the different options and settings in IIS. Eventually I took a look at the Global.asax where the page routing was detailed. I noticed that there was a folder by the same name as the page we were calling. We had Directory Browsing turned off - hence the Access Denied Permission error that was throwing me off!

So I guess the bottom line is, add the above code to your web.config and if it's still not working then make sure you don't have a folder in the project with the same name that you're trying to route to!!

blog comments powered by Disqus

Get In Touch

Follow me online at TwitterFacebook or Flickr.

Latest Tweets