I know this is asked many times, but I couldn't exactly find what I need.
I want to get the server path and add image path to that. I did that
string mypath = Request.Url.GetLeftPart(UriPartial.Authority);
string uploadPath = Path.Combine(mypath, "Upload/Images/");
Response.Write(uploadPath);
This printed http://localhost\Upload/Images/
, why is there a \
in the middle of the path.
I fixed it by adding /
to mypath
like this
string mypath = Request.Url.GetLeftPart(UriPartial.Authority) + "/";
Is this the correct way? or is there is any better way to do this?