2016-02-16 33 views
0

我试图用C#中的版本信息获取我的包之一的URL。我试图解决的问题是我们必须在不同的服务器上的iframe中托管我们的一个页面,我们需要将它传递给它应该显示的任何自定义CSS的URL。我知道捆绑包的基础URL,但我不知道如何获取版本信息传递到该页面。获取当前版本的C#中的版本信息的包的URL

Styles.Url("~/css/someBundle").ToString(); //gets me the base url "/css/someBundle" in this case 

我需要知道怎么去遵循

回答

0

基于在这里剃刀文件中查找从@Scripts.Render(name)定义,似乎也有Url方法的部分?V = {版本信息} :

public static class Scripts { 
    [...] 
    // 
    // Summary: 
    //  Returns a fingerprinted URL if the virtualPath is to a bundle, otherwise returns 
    //  the resolve URL. 
    // 
    // Parameters: 
    // virtualPath: 
    //  The virtual path. 
    // 
    // Returns: 
    //  A System.Web.IHtmlString that represents the URL. 
    public static IHtmlString Url(String virtualPath); 
} 

编辑:这给了一个快速测试:它不会返回路径,相对于网站的根,所以你需要转换为绝对URL。