开发者

SPWeb.Url returns wrong URL

开发者 https://www.devze.com 2022-12-17 09:17 出处:网络
I have a web application in SharePoint that has been extended to another zone (Extranet). The access URL for the default zone is http ://server1, and the URL for the extranet zone is https: //www.serv

I have a web application in SharePoint that has been extended to another zone (Extranet). The access URL for the default zone is http ://server1, and the URL for the extranet zone is https: //www.server1.com.

Now, when I access the site via the extranet zone, I find that SPContext.Current.Web.Url returns http ://server1. I would have expected https ://www.server1.com, since that's how开发者_如何学Python I'm accessing the site. What am I doing wrong?


Try using:

SPContext.Current.Site.MakeFullUrl(SPContext.Current.Web.ServerRelativeUrl);

That should take into account your access mappings.


Odd...

As an alternative, have you tried using HttpContext.Current.Request.Url ?

0

精彩评论

暂无评论...
验证码 换一张
取 消