SYSK 232: Why Are There Four HTTP GET Requests Retrieving an AJAX Enabled Web Page?

Last weekend, I was playing around with an AJAX.NET application, and I notices that browsing for a simple page like this:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>AJAX Test</title>

</head>

<body>

    <form id="form1" runat="server">

        <asp:ScriptManager ID="ScriptManager1" runat="server" />

        <asp:UpdatePanel runat="server" ID="up" UpdateMode="Always">

            <ContentTemplate>

                <asp:TextBox runat="server" id="TextBox1" Text="Life is great!" />

                <asp:Button runat="server" ID="Button1" Text="Click Me!" OnClick="Button1_Click" />

            </ContentTemplate>

        </asp:UpdatePanel>

    </form>

</body>

</html>

 

results in four HTTP GET requests:

 

1. text/html; charset=utf-8

http://localhost/AJAXEnabledWebSite/Default.aspx

 

2. application/x-javascript

http://localhost/AJAXEnabledWebSite/WebResource.axd?d=v5roqONgVR-sf_zrVFQMOQ2&t=632962720872343750

 

3. application/x-javascript

http://localhost/AJAXEnabledWebSite/WebResource.axd?d=EygI2gKDwUOK9FSaMtQkEPKRMRHZDDRmRIg_a7QF9RuyuJpOfPKmOpKpTxPEuXG52lAUj17PYR1LXqTWkF8ONDGaSLDow7XPxTme-Q4uwdBslvlqch-noDL58-aT22S9WMPB0JBv2fnQikxtS_eRS7DTeeXo2KiQtBveJFO-Dnk1&t=632967766247355956

 

4. application/x-javascript

            http://localhost/AJAXEnabledWebSite/WebResource.axd?d=EygI2gKDwUOK9FSaMtQkEPKRMRHZDDRmRIg_a7QF9RuyuJpOfPKmOpKpTxPEuXG52lAUj17PYR1LXqTWkF8ONDGaSLDow7XPxTme-Q4uwdBslvlqch-noDL58-aT22S9EL1wDddOyZMGoZYMIUk8uKe2u36U4nbLLNJl2S7Xg4o1&t=632967766247355956

 

So, what web resources is my browser requesting to download?

 

I new that WebResource.axd is an HTTP runtime handler of type System.Web.Handlers.AssemblyResourceLoader. It looks for the web resource identifier in the QueryString method of the Request object, and then tries to load the assembly and extract the requested resource.

 

The format of this URL is WebResource.axd?d=encrypted identifier&t=time stamp value. The "d" stands for the requested Web Resource. The "t" is the timestamp for the requested assembly, which can help in determining if there have been any changes to the resource.

 

So, all I had to do was to decrypt the resource identifiers above (e.g. v5roqONgVR-sf_zrVFQMOQ2)… I will explain in tomorrow’s post how I was able to do that…

 

The results showed me that the requests #2, 3 and 4 were for the following resources:

  • WebForms.js
  • Microsoft.Web.Resources.ScriptLibrary.MicrosoftAjax.debug.js
  • Microsoft.Web.Resources.ScriptLibrary.MicrosoftAjaxWebForms.debug.js