Are you getting ‘Requested URL: /WebResource.axd – 404 NotFound’ response?

I’m working on a website which is written in traditional ASP.NET, uses AjaxControlToolKit and all kinds of historic goodies. If we where in 2008, I’d be buying the original developers a beer.

However, what you can’t rely on is what gets changed after. The project uses RegisterClientScriptResource in quite a few places, been a while since I used this. Now I took this project on because of quite a big issue: Google made Maps v2 obsolete and it needed fixing. The code is a cluster of JS api’s intertwined into custom .NET Controls and 3rd party libraries.

Now if you’ve used RegisterClientScriptResource before, you will know that you need to reference the JS file in the project and mark the content as “Embedded Resource”. Something I’d forgotten and spent quite a number of hours trying to remember.

Because of the issue with Google, somebody else took a stab at it, for some reason they’d excluded the js files from the project, then added blank empty files of the same name and then excluded those too. Fun.

Anyway, if you’re getting the kind of errors below. Make sure you’re including the JS files in the project and setting their ‘Build Action’ to ‘Embedded Resource’ like this:

 

Event log error

Log Name: Application
Source: ASP.NET 4.0.30319.0
Date: 10/15/2018 10:39:11 PM
Event ID: 1309
Task Category: Web Event
Level: Warning
Event code: 3012 
Event message: An error occurred processing a web or script resource request. The requested resource '<filename>.js' does not exist or there was a problem loading it.

 

IIS error display to end user if you request /WebResource.axd directly

Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /WebResource.axd

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0

 

If you’ve done this and you’re still getting these errors, then my friend, I wish you good luck. Nobody can help you.

Comments