19

I wonder if it is possible to use the new ASP.NET Core Framework without MVC Core. Are there any examples on how to achieve a small web page without integrating the whole MVC Framework? Serving simple routed razor pages?

1
  • 1
    I am thinking about old aspx pages, no Model View Controller pattern. I am just curious, as far as I know, ASP.NET Core needs MVC to make sense?! ASP.NET Core provides low level routing, MVC Core offers it's own routing (guess it's based upon the low level routing). Commented Nov 1, 2016 at 10:30

2 Answers 2

5

You can use MVC Core for REST API only (without using razor views, or for using your own template engine) by referencing only 'Microsoft.AspNetCore.Mvc.Core' package.

If you don't need MVC Core at all, just use '.NET Core Console Application' project template.

Regarding 'old aspx pages' without MVC pattern (from your comment): in current MVC Core version you cannot use razor views without controller; according to ASP.NET Core roadmap, this feature is planned for future 1.2 release.

Sign up to request clarification or add additional context in comments.

2 Comments

on that roadmap I can not see anything about 1.2 release, what do you speak about Vitaliy?
@HelloWorld this is "Razor Pages" feature planned for MVC Core 2.0
3

Yes, you can use Razor pages instead of a complete MVC project.

This Microsoft introduction explains how to use Razor pages and its most important features without the whole MVC framework.

This page uses the following sentences to decribe Razor pages:

As part of the release of .NET Core 2.0, there are also some updates to ASP.NET. One of those is the addition of a new web framework for creating a “page” without the full complexity of ASP.NET MVC. New Razor Pages are a slimmer version of the MVC framework and in some ways an evolution of the old “.aspx” WebForms.

1 Comment

Razor pages still require models and aren't nearly as simple as Web Forms. They don't require full MVC, but it's worth pointing out that you can't seem to escape models in your back end when using ASP.NET Core, no matter which path you choose (Razor Pages, Blazor, MVC, WebAPI, etc.). (ASP).NET 5+ is 100% model-based.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.