views:

197

answers:

1

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!

A: 

I was able to get this to work just by making a new Page Object

Page p = new Page();
p.ClientScript.GetWebResourceUrl(typeof(MyHandler), "myimagename");
chrishawn