StoneHeart
StoneHeart

Reputation: 16590

asp.net mvc - How i convert local file path string to http url

After saved upload file, i got local url of this file, how i convert it to http url?

Upvotes: 2

Views: 3393

Answers (1)

user54065
user54065

Reputation:

public static string PathMap(string path)
{
    string approot = HttpContext.Current.Request.PhysicalApplicationPath.TrimEnd('\\');
    return path.Replace(approot, string.Empty).Replace('\\', '/');
}

source : http://www.aspapp.com/forums.asp?ForumId=11&TopicId=3536

Upvotes: 4

Related Questions