25

I am looking for the file WebResource.axd (to see its source code) but I can't find it.
Where is it?

1 Answer 1

49

.axd files are typically implemented as HTTP Handlers. They don't exist as an ASP.NET web page, but rather as a class that implements the IHttpHandler interface.

If you look in the root Web.config (%WINDIR%\Microsoft.NET\Framework\version\Config\Web.config) you'll find the following entry:

<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="True" />

This entry says, "Hey, if a request comes in for WebResource.axd then use the HTTP Handler AssemblyResourceLoader in the System.Web.Handlers namespace.

The code for this class is a bit lengthy, so I can't post it here, but you can use a disassembler like the free Reflector to view this class's source code. You could probably get the original source code (with comments) by using the NetMassDownloader tool.

3
  • 7
    I posted more information about WebResource.axd and its purpose on my blog @ scottonwriting.net/sowblog/archive/2010/10/28/… Commented Oct 28, 2010 at 18:28
  • I understand that WebResource.axd is a HTTPHandler as is ScriptResource.axd. What, basicly, is the difference as they seem to do the same functionality. Commented Oct 28, 2010 at 19:34
  • 1
    @David Williams: I don't know for sure. Keep in mind that WebResource.axd was introduced in .NET 2.0. IIRC, the ScriptResource.axd was added for the ASP.NET AJAX Framework, which was initially developer for 2.0, but after 2.0 shipped. My guess is that when developing ASP.NET AJAX Microsoft realized there was some functionality they needed that was not part of WebResource.axd, so they created a new handler to give them the functionality needed for ASP.NET AJAX. That is my guess; to get a definitive answer you'd need to talk with someone at Microsoft. Commented Oct 28, 2010 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.