开发者

Is it possible to store asp.net mvc 3 razor partial views in a shared website to be used by multiple applications?

I 开发者_运维百科would like to centralize partial views and controls for our corporate apps, but when I try and reference a partial view hosted in a different virtual directory (iis6), it throws the error:

"The virtual path '/CommonWeb/views/_Grid.cshtml' maps to another application, which is not allowed."

Is there some way to allow this functionality easily?


Take a look at the RazorGenerator project, which allows you to compile your views into a library, which you could then reference from multiple MVC projects.


normally for anything that would be central the easiest method would be to create nuget packages for your code, you can then upgrade your systems nuget package as and when you make changes to your main trunk / re-usable features, this way you dont have to worry about cross domain request etc or having to build some kind of API.

http://docs.nuget.org/ is the documentation

and a self updating website with nuget\

http://haacked.com/archive/2011/01/15/building-a-self-updating-site-using-nuget.aspx

may note be the best, but it does create the ideal situation of code once and use everywhere

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜