2

Is it possible to get a web resource from an .ashx handler? We have resources (images) in a class library and would like to reference them from an ashx handler. Normally you get the url by doing something like:

Page.ClientScript.GetWebResourceUrl(this.GetType(), "myimagename");

But, in my case we have the IHttpHandler and the resources in a class library (not the web app). In the web app, there is an .ashx that points to the IHttpHandler in the class library.

In the IHttpHandler, there is no Page and no ClientScriptManager. How can one get the url to a web resource from the context of an .ashx handler?

Thanks!

4

1 回答 1

4

我只需制作一个新的页面对象就可以让它工作

Page p = new Page();
p.ClientScript.GetWebResourceUrl(typeof(MyHandler), "myimagename");
于 2009-09-23T18:38:26.413 回答