开发者

Changing the WebResource.axd URL

ASP.NET automatically includes the following script tag:

<script src="/WebResource.axd?d=8H_C0aee9xE8e9a-3YoRhA2&amp;t=633413907763620168" type="text/javascript"></script>

However the clients site is being proxied through another sit开发者_开发问答e. So the URL to the root of their site is:

http://domain.com/somename/

So I need to prefix the WebResource.axd with /somename so the resulting tag will look like this:

<script src="/somename/WebResource.axd?d=8H_C0aee9xE8e9a-3YoRhA2&amp;t=633413907763620168" type="text/javascript"></script>

What I am not sure is how to actually set this? Is there a web.config setting I can set so it has this prefix?


I think that this function Response.ApplyAppPathModifier("You path"); can make the work for you.

on Global.asax

protected void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
   string HereIsMyFileName = HttpContext.Current.Request.RawUrl;

   if HereIsMyFileName contains the "webresource.axd"
     then change it to what ever you like using
        Response.ApplyAppPathModifier("You path");

Hope that this helps.


Well, you're pretty much screwed here. Reflector reveals with all certainty that this is hard-coded and cannot be changed.

Your only option is to find a workaround. For example, you can create a filter (HttpFilter) that would replace "WebResource.axd" with appropriate address.

Another thing I can think of - if you control the proxy server, you could have it filter out such requests and redirect them appropriately based on Referrer.

Good luck.


You can catch the output stream and search/replace "/WebResource" with "WebResource" or with the path you need...

Try the solution from here: Change the requested url of WebResource.axd

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜