SharePoint 在后面的代码中获取当前页面的完整 URL [英] SharePoint get the full URL of the current page in code behind

查看:50
本文介绍了SharePoint 在后面的代码中获取当前页面的完整 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SharePoint 中,您如何从背后的代码中获取您所在页面的网址?例如包含 blah.aspx 页面...

In SharePoint how do you get the url of the page you are on from the code behind? e.g. with the blah.aspx page included...

SPContext.Current.Web.Url 给出 http://vm/en/

SPContext.Current.Web.Url gives http://vm/en/

我需要 http://vm/en/Pages/blah.aspx

推荐答案

您仍然可以获取 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.

这篇关于SharePoint 在后面的代码中获取当前页面的完整 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆