Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a single content Web application in the Default zone of my MOSS 2007 farm, which I then extended to the Extranet zone. The default zone web application uses Windows authentication and standard HTTP, while the extranet zone uses forms authentication and SSL. I have the following alternate access mappings configured:

Internal URL            Zone      Public URL for Zone
--------------          -------   ------------------------
http://server1          Default   http://server1
https://www.server.com  Extranet  https://www.server.com
http://www.server.com   Extranet  https://www.server.com

Now I'm certainly not an AAM expert, so let me know if any of those seems wrong from the outset. The problem I'm having is, when I access my site using https://www.server.com, I'm finding that SPContext.Current.Web.Url returns http://server1. I was expecting https://www.server.com, instead.

So, did I miss something or are my expectations out of line?

share|improve this question

2 Answers 2

you could try the following:

using(SPSite site = new SPSite(SPContext.Current.Site.Zone, SPContext.Current.Site.ID))
{
  //your code
}
share|improve this answer

you may want to review the answer from a smiliar question on StackOverflow using the SPSite.MakeFullUrl method as well:

    using(SPSite site = new SPSite(currentSiteId, SPUrlZone.Default) 
{ 
    string publicUrl = site.MakeFullUrl(serverRelativeUrl); 
    // note that MakeFullUrl takes a server relative url not a site relative one 
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.