我正在尝试找到一种方法来确定页面对象的URL。看起来你只能获取当前上下文的路径。
Request.Url
来获取它。Request.RawUrl - /informit/subdir/pathsample.aspx/extra
Response.ApplyAppPathModifier("foo.aspx") - /informit/subdir/foo.aspx
this.ResolveUrl("~/client.aspx") - /informit/pathsample.aspx
string targetUrl = HttpContext.Current.Request.Url.Scheme
+ "://"
+ HttpContext.Current.Request.Url.Authority
+ this.TemplateSourceDirectory + "/Page.aspx";
它应该通过以下方式可用:
string currentUrl = Page.Request.Url.ToString();