| 【相对路径】 | |
| Request.ApplicationPath | /src |
| Path.GetDirectoryName(HttpContext.Current.Request.RawUrl ) | //src//Xiaoshe |
| Context.Request.Path | /src/Xiaoshe/Xiaoshe_New.aspx |
| Context.Request.CurrentExecutionFilePath | /src/Xiaoshe/Xiaoshe_New.aspx |
| Context.Request.FilePath | /src/Xiaoshe/Xiaoshe_New.aspx |
| HttpContext.Current.Request.RawUrl | /src/Xiaoshe/Xiaoshe_New.aspx |
| HttpContext.Current.Request.Url | http://localhost:1344/src/Xiaoshe/Xiaoshe_New.aspx |
| TemplateSourceDirectory | /src/Controls |
| 【绝对路径】 | |
| Server.MapPath("./") | E://Wonsoft//Pro2//src//Xiaoshe// |
| Server.MapPath("") | E://Wonsoft//Pro2//src//Xiaoshe |
| Context.Request.PhysicalApplicationPath | E://Wonsoft//Pro2//src// |
| Context.Request.PhysicalPath | E://Wonsoft//Pro2//src//Xiaoshe//Xiaoshe_New.aspx |
| MapPathSecure(TemplateSourceDirectory) | E://Wonsoft//Pro2//src//Controls string |
| 【其他】 | |
| Control.ResolveClientUrl(string relativeUrl) | |
| Control.ResolveUrl(string relativeUrl) |

本文详细介绍了ASP.NET中各种路径获取方式的区别,包括相对路径和绝对路径的获取方法,并对比了不同API如Request.ApplicationPath、Request.RawUrl等在实际应用中的表现。
418

被折叠的 条评论
为什么被折叠?



