views:

3108

answers:

4

Hello,

Here is my program: I'm uploading an image(Stream, FileInfo or whatever you like) to a server at this virtual directory: "C:\_Resources\Assets"

But then, I want the server to return the UNC path of that image to display it in an tag, that is to say "http://localhost/Trunk/Assets/image.jpeg"

In fact, I'm trying to do the opposite of the Server.MapPath Method.

How do I get that please?

Thanks.

A: 

Anyone have a clue?

+1  A: 

Why not just create a string and replace the "C:_Resources" with "/Trunk" ? Might not be ideal but it should get you going.

TWith2Sugars
+1  A: 

url = "\\" + Environment.MachineName + Path.GetFullPath(document.FileName).ToString().Split(':')[1];

Aditya
A: 
string file = "\\\\" + someServer + "\\" + someFile;
file = file.Replace(":\\","$\\");

And, if you don't feel like using those sill escape characters...

string file = @"\\" + someServer + @"\" + someFile;
file = file.Replace(@":\",@"$\");
AutomationNation