I have a question about URI templates in WCF Services
- by Debby
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.