Return a URI for local resource from a webservice
Posted
by peterkellyonline
on Stack Overflow
See other posts from Stack Overflow
or by peterkellyonline
Published on 2010-04-26T13:19:25Z
Indexed on
2010/04/26
13:33 UTC
Read the original article
Hit count: 229
c#
|web-services
I want to design a webservice that returns a URI to a local resource on the webserver. What is the best (simplest) way to do this in C# using .asmx webservice?
Or in other words - how can I get the URI for a physical file path in a webservice? Build a URI using the Uri class and the [WebService] namespace attribute?
I know there is
Server.MapPath();
that converts a virtual path into the corresponding physical path. I am looking for a way to do the opposite - having the physical path, I want to get not only the virtual path but the full URI.
So if the webservice URI is http://some.server.com/services/example.asmx, the virtual path to the file I want to return is /Updates/file.xml and the physical path to that file is C:\Updates\file.xml what is the best way to get the URI http://some.server.com/updates/file.xml from that information?
Thanks
© Stack Overflow or respective owner