Have a doubt on uritemplates 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:12 UTC
Read the original article Hit count: 214

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf