asp.net 에서 경로(path) 에 관한 정리
DotNet/asp.net 2010.04.19 16:29 |
1. Server.MapPath
Server.MapPath(".") returns the current physical directory of the file (e.g. aspx) being executed
Server.MapPath("..") returns the parent directory
Server.MapPath("~") returns the physical path to the root of the application
Server.MapPath("/") returns the physical path to the root of the domain name (is not necessarily the same as the root of the application)
ResolveUrl 은 Page 에서만 사용가능하고 핸들러에서는 지원 안한다고 한다.
즉 핸들러에서 처리할 url에 "~" 못 쓴다는 것인가..
위의 내용외에 보다 많은 내용이 http://www.west-wind.com/weblog/posts/132081.aspx 에 언급되고 있다.
2. Request 에서 경로 : http://www.west-wind.com/weblog/posts/132081.aspx
Request Property | Description and Value |
ApplicationPath | Returns the web root-relative logical path to the virtual root of this app. /webstore/ |
PhysicalApplicationPath | Returns local file system path of the virtual root for this app. c:\inetpub\wwwroot\webstore |
PhysicalPath | Returns the local file system path to the current script or path. c:\inetpub\wwwroot\webstore\admin\paths.aspx |
Path FilePath CurrentExecutionFilePath |
All of these return the full root relative logical path to the script page including path and scriptname. CurrentExcecutionFilePath will return the ‘current’ request path after a Transfer/Execute call while FilePath will always return the original request’s path. /webstore/admin/paths.aspx |
AppRelativeCurrentExecutionFilePath | Returns an ASP.NET root relative virtual path to the script or path for the current request. If in a Transfer/Execute call the transferred Path is returned. ~/admin/paths.aspx |
PathInfo | Returns any extra path following the script name. If no extra path is provided returns the root-relative path (returns text in red below). string.Empty if no PathInfo is available. /webstore/admin/paths.aspx/ExtraPathInfo |
RawUrl | Returns the full root relative URL including querystring and extra path as a string. /webstore/admin/paths.aspx?sku=wwhelp40 |
Url | Returns a fully qualified URL including querystring and extra path. Note this is a Uri instance rather than string. http://www.west-wind.com/webstore/admin/paths.aspx?sku=wwhelp40 |
UrlReferrer | The fully qualified URL of the page that sent the request. This is also a Uri instance and this value is null if the page was directly accessed by typing into the address bar or using an HttpClient based Referrer client Http header. http://www.west-wind.com/webstore/default.aspx?Info |
Control.TemplateSourceDirectory | Returns the logical path to the folder of the page, master or user control on which it is called. This is useful if you need to know the path only to a Page or control from within the control. For non-file controls this returns the Page path. /webstore/admin/ |
ResolveUrl 은 Page 에서만 사용가능하고 핸들러에서는 지원 안한다고 한다.
즉 핸들러에서 처리할 url에 "~" 못 쓴다는 것인가..
위의 내용외에 보다 많은 내용이 http://www.west-wind.com/weblog/posts/132081.aspx 에 언급되고 있다.
'DotNet > asp.net' 카테고리의 다른 글
Expire 해더의 미스테리 (0) | 2010.04.20 |
---|---|
asp.net 에서 브라우저 캐시 다루기 (0) | 2010.04.20 |
asp.net 에서 경로(path) 에 관한 정리 (0) | 2010.04.19 |
script 웹 사용자 지정 컨트롤 (2) | 2010.04.14 |
[펌]유용한 메타 태그들 (3) | 2010.04.09 |
HttpHanlder 에서 Session 접근하기 (2) | 2010.03.02 |
댓글을 달아 주세요