且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SharePoint 在后面的代码中获取当前页面的完整 URL

更新时间:2023-02-11 21:53:52

您仍然可以获取 HttpContext 然后使用 HttpContext.Current.Request.Url

You can still get the HttpContext and then use HttpContext.Current.Request.Url

SPContext.Current.Web 是围绕您所在页面的 SPWeb,因此其 URL 是 Web 的 URL,而不是页面.

SPContext.Current.Web is the SPWeb surrounding the page you're on, and thus its URL is the URL of the Web, not the page.