ASP.NET MVC > ASP.NET WebForms, Why?

后端 未结 9 1001
甜味超标
甜味超标 2021-02-01 08:25

I\'ve now completed my first web application using ASP.NET MVC and overall, I still am not grasping why this is getting all the praise and glory. Maybe I\'m being stubborn. I k

9条回答
  •  长情又很酷
    2021-02-01 09:12

    It's true that you need to do more in MVC to get some of the same basic VERY automatic functionality you became accustomed to in WebForms.

    However, in the long run you end up with more control.

    The main thing broken about WebForms is the whole PostBack scenario, and how many hoops you have to jump through to implement something simple WebForms didn't think of. One excellent example is my WebForms-related question: Is there any native way in ASP.NET to do a "success message"?

    I wanted to make a "Record Saved" or "New Record Added" message in a WebForms application. Turns out you have to do some really scary stuff just to get this simple functionality to work, because they don't have a normal way to do this in WebForms, and to do a custom method, you're fighting against the hidden functionality in PostBack.

    In MVC, this would be no problem. You'd still have to write the functionality manually, but you'd have much more control over your page state.

提交回复
热议问题