I have a question about URI templates in WCF Services

Posted by Debby on Stack Overflow See other posts from Stack Overflow or by Debby
Published on 2010-06-11T20:10:23Z Indexed on 2010/06/11 20:32 UTC
Read the original article Hit count: 295

Filed under:
|

I have a web service with following operation contract and my service is hosted at http://localhost:9002/Service.svc/

[OperationContract]
[WebGet(UriTemplate = "/Files/{Filepath}")]
Stream DownloadFile(string Filepath);

This web service would let users download file, if the proper filepath is provided (assuming, I somehow find out that proper filepath).

Now, I can access this service from a browser by typing, http://localhost:9002/Service.svc/Files/(Filepath}

If {filepath} is some simple string, its not a problem, but I want to send the location of the file. Lets us say users want to download file C:\Test.mp3 on the server. But how can I pass C:\Test.mp3 as {Filepath}? I get an error when I type http://localhost:9002/Service.svc/Files/C:\Test.mp3 in the browser.

I am new to web services and find that this community is the quickest way to get answers to my questions.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf