How to fix WebResource.axd JavaScript errors appearing when using routing

I had an issue with one of our 4.0 websites recently. The site was using web forms, routing and had .net validation controls in use. Everything worked great until I used the validation controls and discovered that I was getting 2 JavaScript errors on every page that used these controls.

I spent ages looking for a solution because I was looking for the wrong thing! I thought that the issue was to do with the .net runtime but it's actually to do with the routing side of things. What you need to do is tell .net to ignore the .axd files so that the JavaScript being referenced in the HTML will actually return a valid page.

Thankfully the fix couldn't be easier. In your global.asax file make sure you include an ignore rule for any axd files that your project might create. For example:


void Application_Start(object sender, EventArgs e) 
        // Code that runs on application startup

    public static void RegisterRoutes(RouteCollection routes)
        // your page routes here

Share this post

blog comments powered by Disqus


Follow me online at TwitterFacebook or Flickr. If you want to get in touch with me try emailing me.

Latest Tweets