C#/C# 개념
[C# / .NET / WPF ] HttpServerUtility.MapPath(String) 메서드
냠냠쿠
2023. 9. 6. 15:57
728x90
HttpServerUtility.MapPath(String) Method (System.Web)
Returns the physical file path that corresponds to the specified virtual path.
learn.microsoft.com
- 지정된 가상 경로에 해당하는 실제 파일 경로를 반환한다.
public class SampleClass
{
public string GetFilePath()
{
return HttpContext.Current.Server.MapPath("/UploadedFiles");
}
}
- 괄호안에 문자를 넣어주면 그게 가상경로가 된다. null인경우 현재 경로만 출력되어 나옴.
728x90