Have a doubt on uritemplates in WCF Services
- by Debby
I have a webservice with following operation contract and my service is hosted at //localhost:9002/Service.svc/ (I did not put http: before the localhost, as new user can post only one hyperlink)
[OperationContract]
[WebGet
(
UriTemplate = "/Files/{Filepath}"
)
]
Stream DownloadFile(string Filepath);
This webservice would let users download file, if the proper filepath is provided (assuming, i somehow findout proper filepath).
Now, I can access this service from a browser by typing, //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 webservices and find that quickest way to clear doubts is in this community.