Reputation: 5183
I have kind of a funky question- given the uri http://localhost
, and a relative file path of virtualdirectory\\path\\to\\my\\file.html
, how can I merge these into a valid Url which should be http://localhost/virtualdirectory/path/to/my/file.html
?
I'm using Web.API and a client search to see if a static html file exists in a virtual directory on the server. The client requests the search with jQuery, the Web.API controller does the searching on the local virtual directory. If the file does exist, the controller needs to return a valid Url to the client so the client can view that static html file.
If that makes sense. :)
Upvotes: 0
Views: 516
Reputation: 142174
new Uri(new Uri("http://localhost/"), "virtualdirectory\\path\\to\\my\\file.html".Replace("\\","/"));
Upvotes: 1