SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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  Extranet   Extranet

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, I'm finding that SPContext.Current.Web.Url returns http://server1. I was expecting, instead.

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

share|improve this question

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 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 
share|improve this answer

Your Answer


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