views:

50

answers:

1

I've used jQuery's AJAX on a webforms app (kill me), but it worked fairly well after fighting with the webforms framework for a good while. I had links that would load aspx pages into a content div through jQuery's AJAX functions. One of the biggest issues was dealing with state without using session. I ended up using cookies that were used on the client and server. A major security issue, but the site was internal and not in the cloud so I didn't have to worry about that.

It navigation works great for the user and the speed is amazing, but it obviously isn't the best way to go (using webforms). I'm going to build a MVC app with the same navigation scheme. Anybody have any experience doing it a similar way? Any tips or advice?

+2  A: 

Generally speaking, if you are loading large amounts of content into your app through AJAX calls, it's not a good thing. The reason for this is that if it is public, then you kill the searchability of your site by sites like Google, Bing, etc, etc.

If you are still on an internal network, then searchability isn't an issue, but it also is sloppy from a URL structure point of view, as it prevents people from bookmarking content that is relevant to them, and doesn't allow you to hone in on specific parts of the site when you want to.

ASP.NET MVC doesn't encourage or discourage this, but what I would recommend if you insist on going this route is to take a look at some of the templating packages available for javascript (you can use jQuery to develop your own if you wish), and return JSON content from your controllers which you would then act on when you call it using jQuery from the client side.

casperOne
Very good answer. I agree completely. This app will be internal as well, but I would still like for people to easily bookmark their locations. This is an issue I have struggled with as well.
WVDominick
WVDominick: While I love jQuery and ajax, actually processing a new URL and page *isn't a bad thing*. Sometimes it is overkill, and it appears that is the situation here. Look at StackOverflow, when you add comments and the like. It uses jQuery/Javascript to add the content there, but if you post a question, it takes you to the new url. URL structure is an important part of *any* successful website, and you should think about this as you migrate to ASP.NET MVC.
casperOne
Yes, that seems a likely solution. I wish I could vote the answer up, but I'm still a noob. Thanks!
WVDominick
WVDominick: Not a problem. Just accepting the answer that you feel is best makes you a good StackOverflow participant. =)
casperOne