As some of you know I do some SharePoint development as well, and I decided to try to run an application developed with ASP.NET MVC within SharePoint.
Why I want to do this? Because we could leverage all strong points of ASP.NET MVC like separation of concerns, testability, clean HTML together with the huge foundation that SharePoint offers. I am definitely not the first who wanted to do this, so help was allready on it's way.
SharePointMVC from Simon Cropp which is available for download on CodePlex is a great start for getting your ASP.NET MVC application to run in SharePoint.
Here is how it works:
- A SharePoint Master Page contains all SharePoint styles and theme
- A custom ASP.net page (MVCHostingPage) is based upon the SharePoint Master Page
- MVCHostingPage contains a web control called RenderControl
- RenderControl (and other internal classes) interrogates the current request and forwards it onto the ASP.NET MVC rendering engine.
- A HttpHandler takes all requests to *.mvc and redirects them to the MvcHostingPage.aspx page.