This is a migrated thread and some comments may be shown as answers.

After ajax postback, CSS is reloaded with incorrectly encoded &

14 Answers 107 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 27 Jul 2012, 02:43 AM
Hi,

After an AJAX postback occurs, I notice that the CSS is reloaded but with an incorrectly html encoded & instead of &.

This is a bit hard to explain, so please see it for yourself at this site: http://tinyurl.com/4zcuexz

The three cascading drop downs on the right of the screen use Telerik Ajax.

To reproduce the bug:

1) Open Firebug's CSS panel, and you will see that there is a CSS file called something like DependencyHandler.axd?s=L2Nzcy9tYWluLmNzczs%3d&t=Css&cdv=97

2) Initiate an ajax postback by making a selection from the top drop down.

3) Now look in Firebug and you will see that a new CSS stylesheets has appeared, with an incorrectly encoded & in the querystring:
DependencyHandler.axd?s=L2Nzcy9tYWluLmNzczs%3d&t=Css&cdv=97

This website was built a long time ago, and we are using version 2010.3.1317.40 of Telerik.

14 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 31 Jul 2012, 01:01 PM
Hi Andrew,

The link is correct on initial load and after Ajax as well.
On initial load it is:
"/DependencyHandler.axd?s=L2Nzcy9tYWluLmNzczs%3d&t=Css&cdv=97"
Absolutely the same is after the Ajax.

Check using ViewSource of the page first, and then using the response of the Post request in the Firebugs Network Traffic tool.

Actually the correct link contains encoded ampersants as & to avoid problems with the page validation and some browsers.

Check the ViewSource instead of the CSS panel, since the firebug just displays it decoded in the CSS panel.

Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrew
Top achievements
Rank 1
answered on 01 Aug 2012, 02:05 AM
Hi,
I don't believe that is correct.
If I use LiveHttpHeaders I can see that when the page is first loaded, a GET request is made to /DependencyHandler.axd?s=L2Nzcy9tYWluLmNzczs%3d&t=Css&cdv=97.

After the dropdown is selected and the ajax call occurs, another request is made to /DependencyHandler.axd?s=L2Nzcy9tYWluLmNzczs%3d&t=Css&cdv=97. This request should not be necessary because the css file should be cached on the browser already, but because of the different url, it is retrieved for a second time.
0
Vasil
Telerik team
answered on 01 Aug 2012, 06:45 AM
Hi Andrew,

Check this screenshot of your side and its code. It looks correct to me.
I am also attaching an screenshot of the response during Ajax and as you can see the link is the same.

Please note that on ajax call (when i select something from the dropdowns in right), my browser does not get any CSS files. Can you confirm that you have not disabled the browser caching? Can you test in different browser and/or different machine?

Greetings,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrew
Top achievements
Rank 1
answered on 01 Aug 2012, 07:41 AM
Yes, but the href attribute in the HTML source is encoded. When Firefox makes a request it decodes the href attribute first. Telerik should be doing this too, but doesn't.

Follow these steps to see the problem:
* Clear browser cache
* Open Firebug->Net->All
* Load our homepage - notice in Firebug that a request is made to /DependencyHandler.axd?s=L2Nzcy9tYWluLmNzczs%3d&t=Css&cdv=97  (not the encode version - Firefox has decoded the html, as it should)
* Now use the drop down to initiate an ajax request.
* Notice in Firebug how another request is made to /DependencyHandler.axd?s=L2Nzcy9tYWluLmNzczs%3d&t=Css&cdv=97

It shouldn't have to make this second request because it should be cached, but because Telerik hasn't decoded the & symbols, the browser thinks it is a different file.
0
Vasil
Telerik team
answered on 01 Aug 2012, 08:48 AM
Hello Andrew,

The part of the code which request the resources is from the Microsoft Ajax implementation, and it is not something that we can change whatsoever. Clearly the arguments in $create function are correct. You probably can debug the Microsoft Ajax framework to see where these references are used and when request are made, or ask in the asp.net forums for further information.
Also try to use asp:UpdatePanel instead of the RadAjaxManager to see if the problem will be replicated.

Greetings,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrew
Top achievements
Rank 1
answered on 01 Aug 2012, 09:19 AM
Hi thanks,

OK I will ask Microsoft and maybe they will fix it. Haha just kidding.

Do you guys have control over the arguments to $create?

I disagree that the arguments to $create are correct. $create is a javascript function, therefore the urls do not need to be html encoded. The html source is html, therefore the attributes values should be encoded.
0
Vasil
Telerik team
answered on 01 Aug 2012, 09:47 AM
Hi Andrew,

Did you tried to use asp:UpdatePanel and what was the result?

All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrew
Top achievements
Rank 1
answered on 02 Aug 2012, 06:53 AM
Hi,

The behaviour of asp:UpdatePanel is very different to Telerik's RadAjax - I don't even know if the UpdatePanels can send down CSS includes in the same way that Telerik can.

That said, to answer your question, no, the UpdatePanel doesn't have the same problem but that is because the UpdatePanel doesn't resend the CSS like Telerik does.

<head runat="server">
    <title></title>
    <link rel="stylesheet"  href="/css/mycss.css?test&amp;query" type="text/css"/>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager runat="server" ID="sm"></asp:ScriptManager>
 
        <asp:UpdatePanel runat="server">
            <ContentTemplate>
            <asp:TextBox runat="server" ID="txt"></asp:TextBox>
            <asp:Button runat="server" ID="btnGo" Text="Go"/>
            </ContentTemplate>
        </asp:UpdatePanel>
         
         
    </div>
    </form>
</body>
</html>


Here is a simple example using Telerik RadAjaxPanel. This code quite clearly demonstrates that there is a bug with RadAjax:

<head runat="server">
    <title></title>
    <link rel="stylesheet"  href="/css/mycss.css?test&amp;query" type="text/css"/>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager runat="server" ID="sm"></telerik:RadScriptManager>
        <telerik:RadAjaxManager runat="server" ID="ram"></telerik:RadAjaxManager>
 
        <telerik:RadAjaxPanel runat="server">
            <asp:TextBox runat="server" ID="txt"></asp:TextBox>
            <asp:Button runat="server" ID="btnGo" Text="Go"/>
        </telerik:RadAjaxPanel>
         
         
    </div>
    </form>
</body>
</html>
0
Vasil
Telerik team
answered on 06 Aug 2012, 11:39 AM
Hi Andrew,

Okay, I see your point in here. Yes the CSS files are included differently. However in sample pages, and also in our demos page this problem does not seem to happen. Could you try to insulate it in sample web page and send its code for further debugging?

Kind regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrew
Top achievements
Rank 1
answered on 07 Aug 2012, 04:57 AM
Hi Vasil,
I have created a solution that demonstrates the problem. What is the easiest way to send it to you? It is a 12 megabyte zip.
0
Vasil
Telerik team
answered on 09 Aug 2012, 10:40 AM
Hi Andrew,

You can attach files when you are sending formal support tickets.
Or upload it in some of your servers or some free hosting and give a link here. Just make sure not to include any assemblies in the archive, just send the code and mention what version you are using. Remove the assemblies from the project and it will become less then a megabyte probably.

Greetings,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrew
Top achievements
Rank 1
answered on 13 Aug 2012, 05:03 AM
Thanks,
I've submitted a ticket (id 577028) containing the zipped solution.

Andrew
0
Andrew
Top achievements
Rank 1
answered on 20 Aug 2012, 05:46 AM
Hi Vasil, did you get the file?
0
Antonio Stoilkov
Telerik team
answered on 22 Aug 2012, 09:38 AM
Hi Andrew,

You could resolve your issue by setting EnablePageHeadUpdate to false as it is shown below.
<telerik:RadAjaxPanel runat="server" ID="rap" EnablePageHeadUpdate="false">
    <asp:TextBox runat="server" ID="txt"></asp:TextBox>
    <asp:Button runat="server" ID="btnGo" Text="Go" />
</telerik:RadAjaxPanel>

Greetings,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Andrew
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Andrew
Top achievements
Rank 1
Antonio Stoilkov
Telerik team
Share this question
or