[转载]Request获取文件路径

本文介绍了ASP.NET中通过HttpRequest对象获取不同类型的URL路径的方法,包括应用程序路径、当前执行文件路径等,有助于理解ASP.NET应用程序中URL的处理方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

       string s01 = Request.ApplicationPath;                          //testweb   
            string s02 = Request.CurrentExecutionFilePath;          //testweb/default.aspx   
            string s03 = Request.FilePath;                                     //testweb/default.aspx   
            string s04 = Request.Path;                                           //testweb/default.aspx   
            string s05 = Request.PathInfo;
            string s06 = Request.PhysicalApplicationPath;             //E:\WWW\testweb\   
            string s07 = Request.PhysicalPath;                              //E:\WWW\testweb\default.aspx   
            string s08 = Request.RawUrl;                                       //testweb/default.aspx   
            string s09 = Request.Url.AbsolutePath;                        //testweb/default.aspx   
            string s10 = Request.Url.AbsoluteUri;                           //http://www.test.com/testweb/default.aspx   
            string s11 = Request.Url.Host;                                      //www.test.com   
            string s12 = Request.Url.LocalPath;                             //testweb/default.aspx

转载于:https://www.cnblogs.com/LD1018/p/8042967.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值