Asp.Net Webforms Vs Asp.Net WebSite(Razor) Vs Asp.Net MVC

前端 未结 6 1365
名媛妹妹
名媛妹妹 2020-12-12 22:36

I think Microsoft must have a reason for enhancing ASP.Net with RAZOR syntax.

On the Create New Website Project dialog of visual studio, there is another o

6条回答
  •  [愿得一人]
    2020-12-12 23:25

    There are not code-behinds by default, but you can easily make your razor file inherits from your custom class:

    @inherits Index
    

    and then

    public class Index : WebViewPage { }
    

    (More information here: http://www.compiledthoughts.com/2011/01/aspnet-mvc3-creating-razor-view-engine.html)

    This is more like an old-fashioned way of doing web, more asp3-like. The difference with mvc is that mvc provides a huge framework that supports real world applications (using routing, controller and actions, and not just "code there in the markup").

    I think it exists for making things that are really simple, but I don't actually know...

    Finally, I would always chose asp.net mvc with razor.

    Hope it helps

提交回复
热议问题