开发者

Remove ajax scripts from html output ASP.net

I am talking about the WebResource and ScriptResouce js files that are added to the page html. They are quite big. On some pages I don't need them, so it is safe to remove them.

It would seem logical just to remove the scriptmanager, however this is not an option. Some pages use ajax based on a query string. and i use an update panel too. So removing the script manager won't work. I th开发者_运维问答ought maybe I could just disable it, but there is no option for that.

So I guess the only option is to remove the scripts from the output html.

Any ideas how to do that?


check out the below links

http://madskristensen.net/post/Optimize-WebResourceaxd-and-ScriptResourceaxd.aspx

http://www.codeproject.com/KB/aspnet/httpcompression.aspx


Well apparently you can remove them by modifying the html output just before rendering.

However I prefer this approach:

Sub DisableAjaxScripts() Handles Me.PreRequestHandlerExecute
    Dim Request = HttpContext.Current.Request

    If (Request.RawUrl.Contains("WebResource.axd") Or Request.RawUrl.Contains("ScriptResource.axd")) Then
        HttpContext.Current.Response.End()
    End If
End Sub
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜