首页
学习
活动
专区
圈层
工具
发布

T4MVC至CDN
EN

Stack Overflow用户
提问于 2011-09-04 02:33:12
回答 1查看 147关注 0票数 2

我想把我的静态内容移到CDN。但我喜欢(爱?)T4MVC,并希望继续使用它。因此,理想情况下,我想在生产中将"http://mysite“替换为"http://cdnaddress/path"”。有人尝试过吗?会有什么缺陷吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-04 12:43:17

在T4MVC.tt.settings.t4中查找ProcessVirtualPathDefault:

代码语言:javascript
复制
// 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;
}

你应该能够通过调整这段代码来达到你想要的效果。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7295053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档