0

I m beginner asp.net mvc developer.And I don't understand, Why has used both Json and ActionResult in Account controller(for register, login and etc.) in default asp.net MVC 4 project?

Thanks.

4

3 回答 3

2

It's because in the ASP.NET MVC 4 the Login and Register forms are shown in a jQuery dialog and both forms POST to the Account controller using AJAX. The other actions that return views are similar to what existed in previous versions. For example if the user has javascript disabled he won't be able to use jQuery dialog and AJAX and he will fallback to standard HTML.

于 2012-04-07T17:32:21.697 回答
1

Do you means having both JsonResult and ActionResult for (register and login view) in default MVC 4 template?

It means two views for both Register & Login form. One is using with ajax and the other is as normal view.

eg: Click on "Register" link on top, it will popup ajax "Register" view. 
    Click on "Login" link on top -> click "Register", it will show as normal view.
于 2012-04-07T17:28:47.307 回答
0

Alariza,

As Darin pointed out, there are two action methods for each form (Register & Login). One action method is used for the popup version of the view and the other is for the normal view.

Don't get discouraged by the negative comments.

于 2012-04-08T03:25:39.450 回答