You have to use Server.MapPath
method which according to MSDN
specifies the relative or virtual path to map to a physical directory.
Take an example to see Server.MapPath
in action for uploading files using asp.net:
'VB.net
If fileUploadControl.HasFile Then
Dim strFileName As String = System.IO.Path.GetFileName(fileUploadControl.FileName)
fileUploadControl.SaveAs(Server.MapPath("~/images/") & strFileName)
End If
//C#
if(FileUploadControl.HasFile)
{
string filename = Path.GetFileName(FileUploadControl.FileName);
//Save file to /images directory of web application
FileUploadControl.SaveAs(Server.MapPath("~/images/") + filename);
}