静的コンテンツを CDN に移動したいと考えています。でも、私はT4MVCが好き(好き?)で、使い続けたいと思っています。したがって、理想的には、本番環境で「http://mysite」を「http://cdnaddress/path」に置き換えたいだけです。誰か試した?落とし穴はありますか?
1 に答える
4
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;
}
このコードを微調整することで、目的を達成できるはずです。
于 2011-09-04T04:43:17.057 に答える