1

Hi When migrating from ASP.NET to MVC ASP.NET it looks like the MVC is more AJAX friendly. but still I run into design issue, Does someone knows Microsoft intention about the design when calling AJAX methods? Where do I need to put this methods by default, in a separate controller, the same controller? Is there any kind of official info about it?

Thanks

3 Answers 3

1

I don't think that there is any official best practices. Personally I like to follow RESTful conventions when organizing cotrollers and actions no matter how those actions are consumed (AJAX or not).

Sign up to request clarification or add additional context in comments.

Comments

0

You might wanna try on having a review on some asp.net samples here. This will give you some ideas. :)

Comments

0

I would suggest taking SessionState into consideration when making the choice of method placement.

For instance, I would move ajax actions into a separate controller if I am using session state in regular actions, but not in ajax actions (which makes sense for me) and I would like the ajax methods to execute asynchronously. Then I put those ajax methods in a separate controller and mark the controller as [SessionState(SessionStateBehavior.Disabled)] (or ReadOnly). I have found this to be a great improvement in terms of performance.

Note, that you use Session when you use TempData, ViewData or ViewBag variables.

SessionState is explained here: ASP.NET MVC and Ajax, concurrent requests?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.