gpt4 book ai didi

c# - SharePoint 在代码隐藏中获取当前页面的完整 URL

转载 作者:IT王子 更新时间:2023-10-29 04:29:15 27 4
gpt4 key购买 nike

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

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

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

最佳答案

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

SPContext.Current.Web 是您所在页面周围的 SPWeb,因此它的 URL 是 Web 的 URL,而不是页面。

关于c# - SharePoint 在代码隐藏中获取当前页面的完整 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1544268/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com