How to put an ASP.Net website inside MVC website? - asp.net-mvc

I have an ASP.Net website and I want to put this website inside a MVC website I recently did, so this ASP.Net website will be part from the MVC website.
Is there a standard or a known way to do so?
Ask me if you want to know more information, I am not sure what info could help.

this shows merging an existing asp.net site into a new MVC3 site. The same applies for merging existing into existing. Just get a merge tool and merge them!
http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx

Could you put your MVC project into the webforms one? If so, this nuget will help with that: http://www.nuget.org/Tags/WebForms

Related

add an ASP.NET MVC project to an existing ASP.NET Web forms application

How to add an ASP.NET MVC project to an existing ASP.NET Web forms application. How to call MVC project page from existing website.
You can refer this step-by-step guide on how to do that.
Your question is similar to
Is it possible to host an asp.net MVC in the same folder as asp.net web forms app?
We were in the exact same situation as you and it's not as bad as you might think. Thanks to Nuget it's a fairly easy process that you can follow and Dave Paquette describes how to do it in his blog post
And once you've got Mvc up and running all you need to do to go from one to the other is to redirect to Mvc from webforms:
Response.Redirect("~/Controller/Action/")
You can also use the Mvc routing system to generate routes from within webforms as well:
System.Web.Mvc.UrlHelper url = new System.Web.Mvc.UrlHelper(HttpContexxt.Current.Request.requestContext)
Response.Redirect(url.Action("Action", "Controller"))

How to open MVC 4 view page from webform.aspx page?

basically i am looking for something like this ,
i got webform.aspx page and have button there, if i click on it i need to show MVC view page
idea is i want app with webform and mvc !
what i am trying is :
http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc
but here i am confused about webconfig settings
please help me to get it done,
thanks
Scott Hanselman has a good guide on integrating MVC with a Web Form App, it should take you through the steps, here it is in a nutshell:
Run the Upgrade Wizard (open the Visual Studio2008 Web Application
in Visual Studio 2010)
Create a default ASP.NET MVC application for reference (you'll throw it away later)
Use a differencing tool like Beyond Compare to integrate the new web.config entries from the ASP.NET MVC sections into the upgraded ASP.NET WebForms application

Adding MVC3 to existing webforms solution

OK so I have a large .NET 4.0 webforms solution with many projects. I want to develop a new set of screens in MVC3 that integrate into the site. Do I need to change the webconfig and routing in the existing webforms (web application) root? That seems risky. Can I just add an MVC3 project and integrate that into the web application? What's the easiest, least risky way? Does all the routing have to be done at the root? Also, we use NCache for state management. Thanks.
There is nothing about the "solution" that is webforms, so yes, you can add an MVC project to the solution. If you want to add MVC3 components to an existing webforms project, you can do that, too, but you will have to do some of the work the MVC3 project wizard does for you, like adding routes in global.asax.cs and making some web.config changes. Once complete, a hybrid webforms/MVC3 application works fine.
My recommendation, if you want to go this route, is to create an MVC application and look at the things that it puts into the Global.asax.cs file and the web.config file and compare that to your current application.
Check out
http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx for a good primer.

Can i add MVC project in normal asp.net c# project?

can anybody tell me that if i made a normal asp.net c# project and in that solution i want to add mvc project. so is it possible to call mvc view from normal page which is in first project? if yes then how can i call view page from normal page of asp.net c# project.
on live server how can i call mvc page?
Thanks
Samir
Mixing VB ASP.NET and C# ASP.MVC projects in a single solution
Ok, couple of different things here.
Can a ASP.NET forms project exist in the same solution? Yes
Can you mix MVC with WebForms in the same project? No
Can a MVC site communicate with a WebForms site? Yes, you can easily pass between via simulated form submission or by URL. You could also configure cookies to work across both sites.
Can you have an MVC site and a WebForms site use the same url? No

ASP.NET MVC - Missing "Convert to Web Application" option

I created a new MVC project and added some webforms pages to it in an effort to start adding new pages to my app using MVC and eventually port the old pages over as well. Everything is building and working correctly but I did notice that I don't have the "Convert to Web Application" option when right clicking an aspx file. And I think its not regenerating my designer files when I change the controls on a page.
My guess is that the ProjectTypeGuid is wrong or in the wrong order. Can someone confirm?
Old (Webforms) project file
<ProjectGuid>{4F95C3D9-228E-4BD5-9840-46224BA3EBA7}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
New (MVC) project file
<ProjectGuid>{A4690D3F-695B-4BF4-93B7-EA5B17793051}</ProjectGuid>
<ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
This is so wrong on so many levels but I am going to answer you anyways in the hopes I might get an uptick or something. You have two routes with this. First route which I use all the time is put your mvc applications in their own projects. When your deploying the site drop the webforms application first, and then make a folder in that webforms application and put your mvc application into that folder. That should work like a charm for you. If you insit on having webforms and MVC Framework in the same project, then don't drop your webforms into the view folder. Create its own folder because you can not directly access your aspx pages from the views folder without making modifications to the web.config. Hope this helps.
MVC is available as a Web Project only. The VS2005 style Web Site is not supported.

Resources