Sonntag, 4. April 2010

How to use ASP.NET MVC in SharePoint

Currently I am working on a web application that we are building on top of the ASP.NET MVC Framework. The framework is pretty impressive and allows for a very clean implementation of the MVC pattern.

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:
  1. A SharePoint Master Page contains all SharePoint styles and theme
  2. A custom ASP.net page (MVCHostingPage) is based upon the SharePoint Master Page
  3. MVCHostingPage contains a web control called RenderControl
  4. RenderControl (and other internal classes) interrogates the current request and forwards it onto the ASP.NET MVC rendering engine.
  5. A HttpHandler takes all requests to *.mvc and redirects them to the MvcHostingPage.aspx page.

Keine Kommentare:

Kommentar veröffentlichen

Hinweis: Nur ein Mitglied dieses Blogs kann Kommentare posten.