[英]T4MVC through CDN
我想將我的靜態內容移動到CDN。 但是我喜歡(愛嗎?)T4MVC,並希望繼續使用它。 因此,理想情況下,我只想將生產中的“ http:// mysite”替換為“ http:// cdnaddress / path”。 有人嘗試過嗎? 會有陷阱嗎?
在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;
}
通過調整此代碼,您應該能夠實現所需的功能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.