Calling GetWebResourceUrl from .ashx

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

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

      

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

There is no page in IHttpHandler and no ClientScriptManager. How do I get the url of a web resource from the context of a .ashx handler?

Thank!

+2


source to share


1 answer


I managed to get this to work by simply creating a new page object



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

      

+4


source







All Articles