2012-04-17 67 views
0

您好我想知道爲什麼當我寫這篇文章的網址: http://ServerNameRedacted/IISHostedCalcService/FilesService.svc/GetFoldersAndFiles?selectedFolder=FOLDER//SUBFOLDER字符串在XML

我不能得到的信息的XML。

但是,當我用這個,我的功能至極的參數是完全一樣的東西夾// SUBFOLDER它不工作...

如果我直接在字符串中寫它,它會奏效。所以我不知道爲什麼,因爲參數是完全一樣的...

我應該使用string.format還是什麼?

void listBoxFolders_Tap(object sender, GestureEventArgs e) 
    { 

     Folder directory = new Folder(); 


     directory = (Folder)listBoxFolders.SelectedItem; 


     // Connexion to the webservice to get the subfolders and also the files 
     WebClient wc = new WebClient(); 
     wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadSubFoldersAndFiles); 
     wc.DownloadStringAsync(new Uri("http://myserver.net/IISHostedCalcService/FilesService.svc/GetFoldersAndFiles?selectedFolder=" + directory.FullPath.Substring(25) + '/')); 
    } 

回答

2

考慮到您在代碼中的URI末尾添加了正斜槓,我會提交它們實際上不是相同的。

DownloadStringAsync方法之外創建您的URI字符串,並使用a System.Diagnostics.Debug.WriteLine來查看URI字符串的實際內容。

+0

固定...這正是問題..我的錯誤。 – Kiwimoisi 2012-04-17 12:53:51

+0

它發生在每個人身上。 :) – Robaticus 2012-04-17 12:56:02