Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am starting a new website. It is not, and is never likely to be, a heavily used site. I imagine tens of users at most. I have a lot of C# experience and would like to stay inside the cosy world of Visual Studio for my development.

I've used WebForms in the past but didn't get on with it. I found the whole idea of trying to abstract the real mechanics of the web so that it worked more like a desktop application to be a hindrance, not a help.

I am really attracted to HTML5 + CSS3 + MVC Core, but I have just discovered my hosting provider (whom I am reluctant to leave) doesn't support ASP.NET Core right now.

So, here's my question... (And here I apologise if this becomes a bit 'fuzzy'. I'm struggling to see how the myriad of Microsoft technologies fit together - or don't.)

Can I do something a bit like Razor pages that does not involve WebForms? Can I use static HTML5 + CSS3 for 95% of the site but somehow access a C# back-end when I need to? Ideally, I'd like to do this without all the overhead of the WebForms ViewState palaver.

Sorry if I am not making much sense. Any suggestions or pointers to articles that explain all this stuff would be extremely welcome. And I wouldn't mind getting a good book that takes me through the details of whatever approach I end up taking.

Kind wishes - Patrick

What I have tried:

Lots of internet reading but I am none the wiser.
Posted
Updated 31-Mar-19 13:14pm

 
Share this answer
 
v3
.NET Framework 4.6 fully support ASP.NET MVC

The main difference between ASP.NET MVC and MVC Core is that the later is multiplatform and probably runs 1000x faster.
But the API, usage and output is very similar.
 
Share this answer
 
Comments
Patrick Skelton 30-Mar-19 12:30pm    
@RickZeeland @SuperLloyd

I definitely could have been more specific in my question. I get that MVC is just a pattern. I've done a bit more reading and I think I've arrived at three questions I am still struggling to answer:

1. Can I use Razor syntax with standard ASP.NET?
2. By doing so, can I use the GET/POST web mechanism directly (perhaps by building a RESTful web API, which seems intuitively like a nice way to work to me) and remove all reliance on the WebForms controls and view-state?
3. How does Entity Framework fit in? Is this just a good way to implement the model part of the architecture?

I think I mostly understand all the different bits I am asking about here. I'm just struggling to see which ones I need and which I don't and how the pieces fit together.

- Patrick
Super Lloyd 30-Mar-19 23:47pm    
First, a useful link:
https://dotnet.microsoft.com/learn/web

1. (long answer)
Alright, should I repeat my answer?
"The main difference between ASP.NET MVC and MVC Core is that the later is multiplatform and probably runs 1000x faster."

So yes, ASP.NET MVC (Which runs on the .NET Framework) have razor pages, in fact Razor page were created with the first release of ASP.NET MVC.
Page controller, or WebAPI controller, both available in ASP.NET MVC and MVC Core (did I mention that both API were similar?) both can specify what query they handle (GET/POST/PUT/DELETE)
WebAPI is "optimised" toward data payload (such as XML/JSON) and have a few quirk about it. And Page controller are optimized towards delivering HTML page and a few quirk towards that.


The web story with .NET: WebForm came first, Microsoft was hoping to make web development "as easy as WebForm" (ahem), then came MVC and (mostly) everybody loved it (after a while). But was slow because it was fitting in the WebForm pipeline and there was lot of wasteful code running. Then they made .NET Core and remade a cleaner version of MVC that runs better (1000 times!) with it. It's usage was mostly the same but they simplified many little tings about the API. But the general usage is very much the same.

Razor Page Controller are mostly to display page. WebAPI handle data request better. PageController can do both truly (HTML, Json, ..) but every now and then WebAPI handle dataquery a little bit better....

2. yes you can specify to handle GET/POST/PUT/DELETE

3. Entity Framework is somehow orthogonal. i.e. it doesn't matter for MVC web pages / web services whether your use EntityFramework to access some database or not.
But most people typically do it. Where else one would store heaps of live data?
Patrick Skelton 31-Mar-19 3:49am    
I'm sorry I didn't get it first time around. When you understand something as well as you obviously do, it can be easy to forget what it is like to be coming at this as a newbie. Trust me, I'm no strange to (mostly non-web) development but this wep api landscape Microsoft has created is truly confusing from my newbie viewpoint.

Thank you for your longer answer. It has made things *much* clearer. I think I can now make a sensible choice about the path I should follow.

- Patrick
Super Lloyd 31-Mar-19 20:17pm    
No worries.. good luck! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900