2016-02-16 32 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。