I have been testing Umbraco because it's the most popular 开发者_运维知识库open source CMS in .NET out there and I was curious. It surprised me that is not possible to run it in a virtual directory.
After working some time with ASP.NET and ASP.NET MVC I noticed that sometimes allowing your application to run in a virtual directory instead as well as in a subdomain can lead to bugs and other annoying problems that could be avoided by simply assuming that the application won't run under that conditions.
Is really that important adding support for virtual directory or nowadays subdomains are so easy to make that is not worth the effort?
I think it's worth it! The efforts should not be that huge, simply follow these rules:
- Use relative paths in HTML and CSS
- Use ~/ to get the application root in server-side controls
- Use Request.ApplicationPath in code-behind
Its a question that probably has to be addressed on a case by case basis - the point about a virtual directory is that it can, or at least should be able to, sit fairly seamlessly as part of a larger site where a sub-domain might not be an appropriate solution.
I can sort of see how, in the case of something like Umbraco - which they would argue should be the site - it might not be a feature worth supporting but in the general case you shouldn't be making assumptions about what the most appropriate system architecture is for your client's site and hence I would want to provide support if feasible.
精彩评论