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:

         
    
        
        
    

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!!

Resolve a HTTP 405 error when linking from a Facebook App

We recently had an issue of a page not loading of us once we integrated it with Facebook. This was a simple html page with nothing special on it so I was a bit confused that it would not load in Facebook for me. We were hosting the webpage on a Windows 2003 server running IIS6. Nothing fancy.

Going to the website in the browser worked great but any request coming from app.facebook.com didn't seem to be getting through. I took a look at FireBug to see what was actually being sent and received when I was calling the website from Facebook and noticed that I was getting back a HTTP 405 error. This was telling me that the calls Facebook were trying to make were not allow on my server.

I did a bit of searching on this and didn't find anything in particular about Facebook and these types of errors. However, I did notice that some people would get these errors on other web apps and the issue was down to 'html' or 'htm' file types not allowed to be called by get or posts from external requests.

To resolve the issue you need to go into IIS and right click on the domain giving you the issue and click on 'Properties'.

Next go to the 'Home Directory' tab and click on the 'Configuration' button.

Click on 'Add' on the 'Mappings' tab that just opened and either browse to the following file or enter it in the textbox:

C:\WINDOWS\System32\inetsrv\asp.dll

Type in ".html" (without the quotes) in the extension box and Limit the calls to just "GET,POST" (without quotes).

Click OK to close the popup window and again to return to the IIS domain list.

When you now view your site through your Facebook app it will appear for you without any issues.

Eurl.axd error when redirecting from one asp.net 4 website to another in IIS 6

I recently came across an unusual error when trying to redirect to an asp.net 4 website from another website in IIS6. This came about because a client had 2 domains hosted with us. One domain, lets call it Web1, was setup using asp.net 4 and had a website on it. The other domain, Web2, was just used for emails and contained no website.

The client requested that when users go to the Web2 address they would automatically be brought to the Web1 site. Normally when we do something like this we just setup a redirect rule in II6 on the Web2 domain that redirects to Web1. However, in this instance, once we setup our redirect we were getting an error on the Web1 website saying that it couldn't find a resource: {domain}/eurl.axd/{long number}

After a bit of digging around I came across a good StackOverflow.com query someone had that was similar to my problem. Even though all the answers were not really what I wanted to do I did learn that this was a 'feature' of .net 4, extenionless URLs and IIS6. My solution was to just use a 301 redirect page on the Web2 site and have the user redirected from that page instead of IIS6 itself. This worked like a charm.

So, if you are having this eurl.axd error when redirecting from one website to another and you need to keep extensionless URLs then using a redirect webpage should work for you. Sometimes, the easiest solutions work best!