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?

2 Answers 2


you could try the following:

using(SPSite site = new SPSite(SPContext.Current.Site.Zone, SPContext.Current.Site.ID))
  //your code

You may want to review the answer from a similar 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 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.