本文介绍了什么是WebResource.axd的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有blowery网络和WebResource.axd的烦恼。

I have troubles with blowery web and WebResource.axd.

什么是WebResource.axd的?

What is WebResource.axd?

推荐答案

WebResource.axd的提供了一个访问项目中嵌入的资源。它是一个处理程序,使控制和页面开发者下载嵌入在装配到最终用户的资源。

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.

您在您的程序集信息WebResources:

You include WebResources in your AssemblyInfo:

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

然后你可以用下面的code为你的页面包括路径:

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");

然后添加上述文件(它是在这种情况下,一个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

这篇关于什么是WebResource.axd的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 17:55