Category Archives: Atlas

Fiddler and .Net Authentication

I had an issue recently with in-line java-script not being rendered using AJAX ASP.NET. So I fire up Fiddler to see whats going on. Only when ever fiddler is open the app no longer works, it throws a WebException complaining that the connection was reset or aborted.

We are using Integrated Authentication on a separate server that the app talks to via web services. It turns out by default Fiddler doesn’t get along with the way .Net Web Services authenticate. It closes any connection that returns a 401.

This article explains the problem and the fix (which is to add a custom rule to fiddler to stop it closing the connection)

http://blogs.newsgator.com/inbox/2006/09/fiddler_and_net.html

UpdatePanel and Rendered (Inline) Javascript

It seems that the UpdatePanel essentially replaces the InnerHTML of  a DIV with the delta returned from the server. If you try this yourself you will notice that any javascript elements in the html are not fired.

All javascript registered on the server-side (if you are using .NET) with the ScriptManager is put into a separate section of the returned delta. The atlas runtime obviously then loads these scripts into the document manually.

What if the returned HTML has Javascript tags already rendered in it? Nothing. 😦
Such was our predicament and we had no control over the HTML that would be returned to the UpdatePanel (ReportViewer Control). Could we manually load the javascript ourselves when the UpdatePanel returns the payload? As it turns, we could.

You can create script elements on the fly and they get evaluated as you do. Atlas has the ScriptLoader object that will do it for you if your JavaScript is an external reference. Tweaking this idea we got a solution that found all the new Script elements and added them to the document.

The code is below; the scriptLoader was taken from this post.
The main thing to know is that a script element has a text property that can be modified.
The atlas scriptloader sets the src property whilst the innerHTML and innerText properties are readonly.

Continue reading

Tagged , , ,