R – ASP.NET MVC Application in Sharepoint 2007 virtual directory

asp.net-mvcsharepointsharepoint-2007

I have MOSS 2007 installed at lets say http://localhost:4999/ and I want to have my custom ASP.NET MVC (1.0) application at http://localhost:4999/mvcapp/ – logic dictates that, in IIS, i should create a new application virtual directory under my MOSS site and point it at my custom MVC app.

I've done this and it works for executing my controllers etc, however, none of my /Content content is being returned! All referenced images, javascript and css aren't retrieved.

If I put this app into it's own site, or a virtual application within a non-sharepoint site, this works fine and pulls down the images, js and css as normal.

Note – I'm creating a new application in IIS, not just a virtual directory and I have no requirement for integrating with sharepoint, I just want it to have the same domain and port number.

Any ideas?

Cheers
Tony

** EDIT **
To clarify – the URL's that are being generated aren't the issue – they are correct and are being generated in the same way as they would be if this wasn't hosted under sharepoint. IE: /mvcapp/Content/Scripts/jquery.js etc.

** EDIT 2 **
More clarification – the MVC app has it's own web.config file – but it appears that when using a virtual directory withn a sharepoint site, many of the handler mappings still get pushed up to the child site (Note: This is a virtual directory configured as a seperate application not just a virtual directory).

Whilst I don't want or need SharePoint integration, I need my MVC app to come from the same domain and port to overcome some cross domain issues (a lot of MVC content is iframed into sharepoint in various ways). So sharepoint would be at http://site and my app at http://site/mvc

Best Answer

I would keep them on separate web sites (MVC and SharePoint that is). You could create a new website entirely for your MVC app, and then through IIS, right click your MVC web site, edit bindings, and redirect the traffic from your MVC website to URL you want.