开发者

Retrieving the Javascript files from an ASP.NET WebResource.axd library server side?

开发者 https://www.devze.com 2023-03-24 04:54 出处:网络
I want to do script combining of our Javascript on an ASP.NET (C# 4.0开发者_运维知识库 classic webforms).

I want to do script combining of our Javascript on an ASP.NET (C# 4.0开发者_运维知识库 classic webforms).

I can't directly use the default script combining because we serve some of our Javascript out of a database, so I wrote a custom HTTP handler that pulls from our database and our filesystem to combine scripts. All that is fine.

What I'd like to do, though, is also get the webresource.axd files included in my script combining. But I can't figure out how to get what JS I should include on the server side.

All of the script combining sample code that I've seen from Googling make a separate httprequest from the server to get the necessary webresource javascript, but I feel like that leads to an unnecessary point of failure to have the serve make extra web calls. Does anybody know how to load up whatever dll the webresource.axd is using and ask it for its javascript directly, without going through an HTTP request?

(i.e., given something like /WebResource.axd?d=ir4-Z9VuAfKFCpBYqwpW4UCZ5rikwuzHb4bm5jdsmLoOFF7uCN45KR_x8kqIYoSdVC6mbX9QXLmLqIWGjP0VgFKGVlY1&t=634407077185129362 , how do I turn that into Javascript text, without making an httprequest?)

(I'm assuming that ASP.NET is doing something fancy here like detecting client browser type or language to serve up different JS for different browsers. If it's as simple as manually load the file once and cache it in our filesystem 'cuz the file never changes, then I'll feel dumb but please just let me know.)


http://support.microsoft.com/kb/319292

Assembly.GetManifestResourceStream appears to be the answer for getting the actual text, but I need a resource name to use it. I know how to go from a resource name to a webresource url (page.ClientScript.GetWebResourceUrl), but I don't know how to go in the other direction. Need to rearchitect to pass in one level higher info, the resource name instead of the url.

0

精彩评论

暂无评论...
验证码 换一张
取 消