Search code examples
c#windows-phone-7

String in a XML


I am wondering why when I write this in the URL: http://ServerNameRedacted/IISHostedCalcService/FilesService.svc/GetFoldersAndFiles?selectedFolder=FOLDER//SUBFOLDER

I can't get the information in XML.

But when I use this, the parameter in my function which is exactly the same thing FOLDER//SUBFOLDER it doesn't work...

If I write it directly in a string it will work. So I don't know why, because the parameter is exactly the same...

Should I use string.format or something?

    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) + '/'));
    }

Solution

  • Considering that you're adding a forward slash at the end of the URI in your code, I would submit that they are not, in fact, the same.

    Create your URI string outside of the DownloadStringAsync method, and use a a System.Diagnostics.Debug.WriteLine to see what the actual contents are of your URI string.