C# SPContext.Current.Web.Url返回http而不是https
我开发了几个Web部件,其中我使用SPContext.Current.Web.Url获取Web Url。当使用访问站点时,它会起作用hxxps://abc/ 但是当通过IP访问时,我得到的是http而不是https 问题: 当我访问hxxps://172.1.25.25/ 返回SPContext.Current.Web.Urlhxxp://172.1.25.25/ 当我访问hxxps://abc/ 返回SPContext.Current.Web.Urlhxxps://abc/ 我的备用访问映射 hxxp://172.1.25.25/ 内部网 hxxps://172.1.25.25/ 内部网 hxxp://abc/ 互联网 hxxps://abc/ 互联网C# SPContext.Current.Web.Url返回http而不是https,c#,sharepoint,sharepoint-2010,https,spcontext,C#,Sharepoint,Sharepoint 2010,Https,Spcontext,我开发了几个Web部件,其中我使用SPContext.Current.Web.Url获取Web Url。当使用访问站点时,它会起作用hxxps://abc/ 但是当通过IP访问时,我得到的是http而不是https 问题: 当我访问hxxps://172.1.25.25/ 返回SPContext.Current.Web.Urlhxxp://172.1.25.25/ 当我访问hxxps://abc/ 返回SPContext.Current.Web.Urlhxxps://abc/ 我的备用访问映射
我使用了我在论坛上得到的几种解决方法:(没有任何效果,提前感谢在您的AAM中,您将有一个“区域的公共URL”,这就是SPContext.Current.Web.URL将返回的内容-如果您想使用https,请将其更改为https SharePoint管理中心>应用程序管理>配置备用访问映射>编辑公共URL