【发布时间】:2011-06-17 09:01:39
【问题描述】:
我想编写一个 c# 方法来检索当前页面。例如 Default6.aspx 我知道我可以执行以下操作:
string url = HttpContext.Current.Request.Url.AbsoluteUri;
// http://localhost:1302/TESTERS/Default6.aspx
string path = HttpContext.Current.Request.Url.AbsolutePath;
// /TESTERS/Default6.aspx
string host = HttpContext.Current.Request.Url.Host;
// localhost
但是我怎样才能得到 Default6.aspx?如果url是http://localhost:1302/TESTERS/,我的方法应该返回default.aspx
【问题讨论】: