2013-06-05 43 views
0
public static byte[] BBStorageGetFile(string filePath, int projectId) 
{ 
    var queryString = QueryStringEncoder.bbs_encode("a=g&p=" + filePath + "&s=" + projectId); 
    var url = "http://www.buildbinder.com/base/storageFile.aspx?" + queryString; 

    string urlB = HttpContext.Current.Request.Url.ToString(); 
    if (urlB.Contains("intranet.buildbinder.com")) 
    { 
     url = "http://intranet.buildbinder.com:8000/base/storageFile.aspx?" + queryString; 
    } 

    Uri uri = new Uri(url); 

    WebClient webClient = new WebClient(); 
    webClient.Credentials = CredentialCache.DefaultCredentials; 
    webClient.UseDefaultCredentials = true; 

    webClient.Headers.Add(HttpRequestHeader.Cookie, "culture"); 
    webClient.Headers.Add(HttpRequestHeader.Cookie, "mySession"); 
    webClient.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); 
    webClient.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); 

    byte[] file = webClient.DownloadData(uri); 

    return file; 
} 
+0

看起來您正在使用請求標頭髮送帶有會話值的Cookie,但我沒有看到您正在獲取/設置Cookie值的位置 –

+0

問題出在哪裏? – Suhas

+0

無法識別cookie它包含下載的會話信息 –

回答

1

問題已解決。有人改變了獲取存儲文件所需的一些參數,這個人不與開發團隊分享信息。 :(