Coffeehouse Thread

70 posts

Questions regarding "Web pages" vs "Web forms" vs "MVC"

Back to Forum: Coffeehouse
  • User profile image
    WhatDoYou​Mean

    I have read the descriptions and features of them in www.asp.net website. Still confused about "Web pages" vs "Web forms" vs "MVC".

    1. Web pages is some kind of "view" sitting on top of MVC?
    2. I see that there is more than one MVC "version", is that the case for "Web forms" as well or is there only "one" "Web forms"?
    3. If I use MVC "version 3", when "version 4" comes out, do I need to rewrite a lot of stuff? I know MVC 4 is not out ( or 5, not sure ) but how was it from version 1&2 into version 3. Lots of change and rewrite to make it "version 3"?
    4. Is MVC just a "way of writing applications" or is it a specially made "tool" so to speak?
    5. Which one of those from the coding side, "looks more like" PHP?
    6. Which one do you personally prefer, and why?

    Sorry if my questions seem rather stupid but I am almost completely ignorant regarding ASP.NET.

    Thanks!

  • User profile image
    Maddus Mattus

    1. No, webpages are just small php-like (with Razor) script files wich turn out html.

    2. Web forms is the 'old' asp.net technology, their versions distributed with the .Net framework. MVC is not part of the .Net framework. Web pages are just dynamic html with no serverside controls and no MVC.

    3. Often you can convert the solution, do some small changes and recompile. Unless you have done some seriously freaky stuff.

    4. It's a pattern, wich seperates logic from UI. It provides you with a unit testable way of writing asp.net application, while the designer can do his magic in the frontend pages.

    5. Web pages.

    6. MVC, it's the shizzle. No more page lifecycle, web forms are too loose for enterprise development, good for a hobby or small pet project, but not for 'real' apps.

    Cheers!

  • User profile image
    Proton2

    MVC is a design pattern that you can use.

    There is an article here that might be helpful, except for this one aspect:

    "Please note that this MVC discussion is within the context of desktop applications; Web applications are another story and beyond the scope of this article."

    http://msdn.microsoft.com/en-us/magazine/hh580734.aspx

  • User profile image
    magicalclick

    , WhatDoYouMean wrote

    I have read the descriptions and features of them in www.asp.net website. Still confused about "Web pages" vs "Web forms" vs "MVC".

    1. Web pages is some kind of "view" sitting on top of MVC?
    2. I see that there is more than one MVC "version", is that the case for "Web forms" as well or is there only "one" "Web forms"?
    3. If I use MVC "version 3", when "version 4" comes out, do I need to rewrite a lot of stuff? I know MVC 4 is not out ( or 5, not sure ) but how was it from version 1&2 into version 3. Lots of change and rewrite to make it "version 3"?
    4. Is MVC just a "way of writing applications" or is it a specially made "tool" so to speak?
    5. Which one of those from the coding side, "looks more like" PHP?
    6. Which one do you personally prefer, and why?

    Sorry if my questions seem rather stupid but I am almost completely ignorant regarding ASP.NET.

    Thanks!

    1) No. You can use Web Pages completely by itself.

    2) Web Form usually does not evolve because it is pretty old technology. What it can evolve is already been done, sort of.

    3) I cannot comment on that, but, shouldn't be too bad.

    4) MVC is a pattern, but, yeah, you can say it is a template / tool that MS provides that follows the MVC pattern.

    5) Razor, it doesn't matter you use Web Pages or MVC4, you can use Razor, which is better than PHP to indicate server side code.

    6) Razor + Web Pages. Honestly MVC has really high learning curve and it is quite overkill in many cases. Web Pages is a lot simpler. Razor + Web Pages = simple dynamic HTML generation and program in C# at server side. If you want to pass model around, you can always write the .cs classes and pass those around between method parameters. MVC seem to be able to pass model around among pages? (I am not really familiar with MVC, just trying the tutorial a little). The problem with MVC is you spam 3 files for a page, but, sometimes you are only doing simple stuff that doesn't really need to spam 3 files all over the places.

    6.5) You want to use MVC in co-op environment, where the view can be made by different person. If you are the only person, or you think View should be modified at CSS level, then, Web Pages is more suitable.

    7) Extra note, try this fun Razor code

    @{

    @:@myvariable

    }

    This is a funny way to write value of myvariable within a @{} code block. It is shorter than wrapping the variable with <text></text>.

    8) Reminder, you can use Razor on MVC. Web Pages is just a library that you can use to access URL data, form data, connect to SQLCE and etc. You can actually use the same library in MVC as well.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    WhatDoYou​Mean

    FINALLY, YOU GUYS GAVE ME CLARITY!

    I have been looking all over the place for good answers.

    Thank you very much!

  • User profile image
    Maddus Mattus

    @WhatDoYouMean:

    yw Smiley

    all the elite ASP.Net gurus hang out in the coffeehouse you know Wink

  • User profile image
    WhatDoYou​Mean

    Then I shall disturb you with lots of questions because I am "moving" to ASP.NET. *lol*

    Smiley

  • User profile image
    Maddus Mattus

    @WhatDoYouMean: Excellent choice!

    For specific technical questions, use the TechOff forums, for questions like the above you can post them in the CoffeeHouse.

  • User profile image
    Proton2

    , Maddus Mattus wrote

    @WhatDoYouMean:

    yw Smiley

    all the elite ASP.Net gurus hang out in the coffeehouse you know Wink

    Where do the App, app, app (god I love that word app Wink ) gurus hang out?

  • User profile image
    Maddus Mattus

    @Proton2:

    In their parent's basements ofcourse!

  • User profile image
    WhatDoYou​Mean

    , Maddus Mattus wrote

    @Proton2:

    In their parent's basements ofcourse!

    LOL

  • User profile image
    WhatDoYou​Mean

    I'm confused. When using MVC or Razor, I need to install them into the ( Visual Studio Express ) but when using Web Forms, it's "built in". Does this mean that MVC is a framework sitting on top of another framework (.NET)?

  • User profile image
    Maddus Mattus

    @WhatDoYouMean: MVC is built on top of the .Net framework.

    The .Net framework houses a lot of technologies out of the box, like WPF, Windows Forms and ASP.Net. But there are also a lot of stuff that gets built outside the framework, Silverlight, MVC, etc.

    Big advantage is that they can have their own release cycle, also a disadvantage but I think the pros outweigh the cons.

  • User profile image
    WhatDoYou​Mean

    Frankly, after reading a lot about MVC and trying out the demo stuff in VS Express, I'm pretty scared of it. It's a massive "lock in" that gives me nightmares. It seems that if I use Web Forms and skip the "web form" part and not use post back and such, it would be much easier for me to "move" out to say PHP in case of "need".

    Using MVC, it's like, well it's hard to explain. There is no control and I don't know what the heck is going on in the code.

    Specially when in the Views, code and HTML is still "mixed up" I don't see the advantage of MVC at all so far. Why can't I just make a regular Class in a .CS file and put my code in there?

    Or am I totally off now?

  • User profile image
    cbae

    There's nothing to be frightened about. While MVC is known mostly as a pattern for separation of concerns, it's also routing system based on convention. The convention is very easy to understand and it dovetails nicely with exposing web services.

    IMO, it's far easier to understand how the plumbing for MVC works than it is to understand how WebForms work.

    As far as "lock-in" is concerned, you should be more concerned about lock-in using WebForms. WebForms depends heavily on ASP.NET web controls. With MVC using Razor syntax, you use standard HTML mark-up. It's far more like PHP than WebForms mark-up.

  • User profile image
    WhatDoYou​Mean

    Well, seeing how Microsoft dumps this and locks that lately, I am afraid frankly. The reason I'm trying to learn ASP.NET is to move away from Windows Client and MVC SCARED ME. Sad

    It even handles the routing and stuff as you mention. Zero control. It feels like that thing Lightroom or what it was called. ( Lightswitch )

    Regarding WebForms, as long as I don't use their specific controls, I should be fine, no? I mean, as long as I don't use the runat="server" thingy?

  • User profile image
    magicalclick

    @WhatDoYouMean:

    You can have a MVC site with completely no MVC inside you know. Wink

    MVC is just a template. I don't know how to apply the template after you choose Web Pages route, but, you can easily start from MVC template and don't use any MVC pattern at all, just plain .cshtml file with everything inside (your logic and html generation and redirect). And in case you wants to use MVC, your site can use MVC.

    • You can write .cs file.
    • Just create a folder called App_Code and put your .cs inside. All .cs has to be under App_Code.
    • You can also write .cshtml as class object, but, this, you can place anywhere in the site.
    • All .cshtml files are converted to class at runtime, so, the performance is the same.

    I suggest you to use Web Pages for now to get a feel of how Razor syntax works and how you can use .cs in your site. This is why I don't recommend MVC for beginners, it is additional learning curve.

    Download WebMatrix and start from there. The core of Razor pages are much simplier to use.

    Also REMEMEBR!!!

    Have this in your web.config 

    <system.web>

    <compilationtargetFramework="4.0"debug="true"/>

    </system.web>

    VS Express said it is 4.0 in the GUI, but, sometimes it turns to 3.0 if you don't specify it.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    WhatDoYou​Mean

    @magicalclick: You got a point there. Is "Razor" "built-in" or do I need to install any kind of add-on in case I want to use it with Visual Studio Express?

    Or is Razor only usable in WebMatrix?

    Sorry if I sound stupid but totally new to this. I am trying to keep out as much "extra add-ons" as possible, however.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.