move to mvc from existing asp.net project - c#

I have used .net framework 4.0 to design my web project I want to improve some features on my web site and I decided to use MVC in my project.
I research about mvc I found out System.Web.Routing in .net framework 3.5 is wrapped by System.Web in .net framework 4.0.
In the other side in my host environment I have IIS 7.0 with all necessarily handlers mapped to .aspx and some other extension like .cshtml and support them.
So I think I have all thing for mvc migration. my question is :
Is it possible to move mvc by configure web.config and make some structure for content, view and controller classes but don't change any asp.net pages and configuration like appcode and appdata which I had before in my asp.net application.
Note, I don't want to change or update my old application to mvc I want to add some mvc controllers class and view to my existing asp.net project to use mvc functionality.

Have a look at this walkthrough from Scott Hanselman:
http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx

Related

How can I create an ASP .NET MVC 5 solution?

I never used ASP.NET framework before.
I saw some tutorial videos of ASP .NET MVC 5, but when I create a new project of ASP .NET MVC with .NET framework 4.8, the project doesn't have a StartUp.cs like the tutorial videos.
Can you tell me why this happen? And also how can I have the startup class in my project?
Edit:
I added images of what I'm asking. I hope that you can help me.
How the project is created
How the project has to be
Thank you very much.
I suppose that you need ASP.NET Core project not Framework.
You can check here project structure for asp.net core.

Sharing code between ASP.NET MVC 5, ASP.NET Web Api 2 and Mobile (Xamarin)

I'm an experienced ASP.NET MVC and Web Api 2 Developer and now our company is starting on mobile development.
Our projects use .net framework 4.7.2.
We have a "common library" that all our projects reference.
Also, we have a POCO class project, which, of course, contains only poco classes (we use entity framework 6)
So, what we need is to use that "common library" and the POCO classes with the mobile software, while using them on existing projects, like the ASP.NET MVC 5 project.
What is necessary to accomplish it, considering we do not want to "duplicate" code?
Thank you very much!
You can use Shared Projects.
Here is a complete walkthrough how to achieve that (the tutorial is long so I won't post any steps).
With this, you can reference the models in other projects, and keep the always updated.

Not able to start project as asp.net Core (Razor App)

I have installed VS 2017 community edition and i am trying to create ASp.net Core 2.0 (Razor Page) but i am not getting that template when i create the project as show in this tutorial
What i get is show in below image
I am new to .Net Core and want to start learning .Net Core.
ASP.NET Core with Razor Pages is the third option in your screenshot:
However, unless you will create extremely simple web applications, you should skip it and go to the full ASP.NET MVC (fourth option). While Razor Pages is very new (only some months old), MVC has been pretty much the same for years, and allows for much more development.

Using Asp.net core security in MVC5?

We are using Adal as authentication library but we would like to use the policy functionality in Asp.Net Core security in our MVC5 application. The idea is to compile the Asp.Net Core library to .NET 4.6. This works! However, now I need to click the authentication things in my owin application.
Just adding the AuthorizeAttribute from the library doesn't work, it is not executed.
I have also read about the ported version from P. Schaeflein, but I would preffer to use the libraries provided by Microsoft.
Anyone an idea how to get this working?
Asp.net Core / .net core is a total rewrite of asp.net framework and the way it work is very different. For example Asp.net Core is most made around a Dependency Injection. So moving part of a framework that made for Asp.net Core to Asp.net MVC 4.6 made not work and would have to be rebuild to work with Asp.net MVC 4.6.

How do I use Webforms and ASP.NET MVC together in an ASP.NET Webforms Website project?

I've seen a lot of articles creating hybrid Web Forms applications to also have MVC pages and those work fine.
Unfortunately, I've inherited a Web Forms Web Site (not application), so there is no way to edit project files, add references, etc.
How do I use Webforms alongside ASP.NET MVC when the project is a Web Site project?
It's actually pretty easy to convert a web project to a web application. And from there you can use the 2013 web application project to have webforms, webapi, and mvc all live and play along in the same application.
However, take a look at ASP.Net vNext. They have removed webforms from that model and are using asp.net webpages much like what you are using now. That will be able to work with webapi and mvc so you might want to start learning that instead of converting to see if the programming model fits your upgrade path a little better.
There is a way to convert a website into an application:
How To Convert ASP.NET Website to ASP.NET Web Application
Scott Hanselman also created a NuGet package for adding MVC into a Webforms application:
https://www.nuget.org/packages/AddMvc3ToWebForms/

Categories