views:

60

answers:

2

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 thought 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?

A: 

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
diamandiev