56

I have troubles with blowery web and WebResource.axd.

What is WebResource.axd?

3 Answers 3

61

WebResource.axd provides access to embedded resources within a project. It's a handler that enables control and page developers to download resources that are embedded in an assembly to the end user.

You include WebResources in your AssemblyInfo:

[assembly: System.Web.UI.WebResource("Project.Styles.Main.css", "text/css")]

Then you can get an include path for your Page using the following code:

string includeLocation = Page.ClientScript.GetWebResourceUrl(this.GetType(),    
    "Project.Styles.Main.css");

Then to add the above file (which is a CSS file in this case):

LiteralControl include = new LiteralControl(
    String.Format(includeTemplate, includeLocation));

((System.Web.UI.HtmlControls.HtmlHead)Page.Header).Controls.Add(include);

Then you'll end up seeing references within your page source such as the following:

/WebResource.axd?d=PhPk80h_UWEcbheb-NHNP5WshV_47UOpWqAOl1_li
    UFfN4cNofL74cFlQ1fvpFSf0&t=632573240669964903
1
  • How/where is the includeTemplate declared?
    – Matt
    Dec 9, 2016 at 12:16
10

It's a generated HttpHandler file. Most likely you have some embedded resource in your ASP.NET application, or one of the third party components you use. To transport these in a transparent way ASP.NET makes use of this approach where the correct resource can be identified depending on the passed in querystring. For example:

WebResource.axd?d=PhPk80h_UWEcbheb-NHNP5WshV_47UOpWqAOl1_liUFfN4cNofL74cFlQ1fvpFSf0&t=632573240669964903

Taken from Using WebResource.axd for embedded resources.

0
5

Its for embedded resources.

Working with Web Resources in ASP.NET 2.0

0

Your Answer

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

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