Can someone please explain the difference between Server.MapPath and Request.MapPath and usage scenarios for the two ?
Asked
Active
Viewed 2,484 times
1 Answers
1
ASP.NET has provided at least three different public MapPath methods since version 2.0:
Internally, HttpServerUtility.MapPath
calls HttpRequest.MapPath
.
HostingEnvironment.MapPath
is a static method, throws an ArgumentNullException
if the argument is null or empty, and throws an ArgumentException
if the argument is a relative path.
HttpRequest.MapPath
is not a static method and does not throw the exceptions mentioned above.

Ryan Prechel
- 6,592
- 5
- 23
- 21