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

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

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"))

Sample application for asp.net mvc

I have worked on asp.net 2.0 years ago and recently worked on SL and WPF applicaiton have idea on mvvm. As my next project would be on ASP.net MVC DotNet FW 3.5, I was looking for sample application code using MVC any links\forum on this would be of gr8 help.
Welll I was going through http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-3 and noticed the view uses cshtml file extension rather aspx and was confused. Please, point me to some refernces to start as a biggner.
First of all i'd recommend MVC4 and .Net 4.
The easiest way to learn is create a new project using the default MVC 4 internet project template. It has all the basics covered.
The most important about MVC is that you forget about webpages being files on disk. The .aspx and .cshtml files in MVC are views returned by a controller. A controller is a class which has functions, called Actions in MVC terms. If you have an url /Home/Index MVC would call function Index in controller class Home.
The .cshtml extension is used by view template files rendered by the ASP.Net MVC3 Razor View Engine. I often find videos to be great introductions to topics about which I want to learn more.

Side-by-Side Asp.Net and MVC Razor

We have an existing ASP.Net Web Application. I would like to create an ASP.Net MVC Razor Application where the two applications will work together. A single Master Page would contain menu items that can call .aspx pages as well as Razor .cshtml pages.
I have seen an example using MvcContrib Portable areas utilizing Routing. This particular example has .aspx pages in both (the MVC was not Razor).
Is there an example out there that will show the two running side-by-side and the MVC is Razor? It would be best if I could download a visual Studio Solution so that I can run this.
I am not sure if the MvcContrib way is the latest and best way to achieve this.
I do not want to go Hybrid!
You don't need any other external librarry. You can always convert the existing ASP.NET web forms Project to be a Hybrid one which uses webforms and MVC. You need to add the required MVC assembly references and make some changes to the web.config and you are all set. Scott has a simple and awesome blog post about this where he explains how to do the conversion.
I scribbled a note about how to enable the MVC specific Context menu( Add Controller / Add View) in the hybrid project after conversion here

How to put an ASP.Net website inside MVC website?

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

Separate dll in an ASP.NET webform + MVC website?

I have an asp.net webform website and added a new part in asp.net MVC 1.0.
For an easy maintenance I would like to separate the code into 2 dll, one for webform part and second for MVC part.
If my website is named 'TheWeb', then I only get a single dll named TheWeb.dll
Is it possible and how to proceed ?
Thanks
Sinn'
In your solution add a second project. You get a DLL for each project.

Resources