我想把我的静态内容移到CDN。但我喜欢(爱?)T4MVC,并希望继续使用它。因此,理想情况下,我想在生产中将"http://mysite“替换为"http://cdnaddress/path"”。有人尝试过吗?会有什么缺陷吗?
发布于 2011-09-04 12:43:17
在T4MVC.tt.settings.t4中查找ProcessVirtualPathDefault:
// You can change the ProcessVirtualPath method to modify the path that gets returned to the client.
// e.g. you can prepend a domain, or append a query string:
// return "http://localhost" + path + "?foo=bar";
private static string ProcessVirtualPathDefault(string virtualPath) {
// The path that comes in starts with ~/ and must first be made absolute
string path = VirtualPathUtility.ToAbsolute(virtualPath);
// Add your own modifications here before returning the path
return path;
}你应该能够通过调整这段代码来达到你想要的效果。
https://stackoverflow.com/questions/7295053
复制相似问题