AJAX ASP.net Complaints

Blog

Yes, yes.  I know I have not been updating.  I need to get a schedule down for posting projects and blog entries.  In the meantime, I have to vent about ASP.net.

Don’t get me wrong, ASP.net is very powerful and easy to write.  For beginners, it is very simple (drag and drop) but for power-users, it can be extremely frustrating.

Last week, I modifying an existing ASP.net application to use the fancy AJAX functionality supplied in .NET 3.5.  If you are not familiar with it, the upgrade is simple.  Place a ScriptManager and an UpdatePanel on your existing page (with your content inside the UpdatePanel’s ContentTemplate).

  1. <asp:ScriptManager ID="ajaxScriptManager" runat="server" />
  2. <asp:UpdatePanel ID="ajaxUpdatePanel" runat="server" >
  3.   <ContentTemplate>
  4.     Your existing ASP.net MumboJumbo…
  5.   </ContentTemplate>
  6. </asp:UpdatePanel>

I ran my project and saw that any PostBack calls were made asynchronously without any visible refreshes.  This feature is AMAZING!  No modification of existing code (like with threading) needed!

So you can pretty much guarantee that at this point, I felt great.  My project still worked fine, made calls asynchronously, and I even added an UpdateProgress panel with a simple animated gif to display activity.  The celebration was short, however, as I noticed the calls stopped working.

I restarted the application and it worked fine again.  Navigation to different pages yielded similar results, the application was working as expected.  It took another few minutes before I realized that refreshing a page instead of navigated to it caused all AJAX calls to fail.  According to Firebug, my AJAX calls were all returning “Invalid Viewstate.”  Ugh.

After some intense research, I realized that it was Mozilla Firefox alone that was causing the issue (well, ASP.net AJAX actually… but only when used with Firefox) as Firefox attempts to save form information when refreshing a page.

Luckily, there are many ways to fix this (each having their own problems one way or the other).  Sadly, the method that worked for me and my project was by disabling Event Validation and Validating Requests.  Two major security risks, however any vulnerabilities found are not useful as the users with access to this application (LDAP secured) already have direct server-level access to the data managed by this application.

In the end, it made it VERY difficult for me to keep AJAX calls on this application. And the additional applications I worked on since then have not had AJAX for that very reason. Until there is a simple, logical, and secure solution to the Firefox/ASP.net AJAX issue, I will not be jumping through hoops to get my project to look prettier.

No Comments

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



  • Donate

    If my work has helped you and you want to return the favor, you could purchase something for me from my Amazon Wish List or send me a donation via PayPal.

  • My Lifestream

  • License

    Unless otherwise noted, all source code and compiled files published on this website are released under the terms of the GNU Lesser General Public License.