This is a bit of a reminder for myself, but quite a lot of the URLs you deal with in SharePoint development are relative – that is, something like an SPList.DefaultViewURL might be:
/sites/web/lists/list/allitems.aspx
That’s fine … but sometimes you need a full absolute URL. For example, you might be sending out an email with a hyperlink in it – a relative URL ain’t going to cut it.
Fortunately, there is a very useful function – SPSite.MakeFullUrl() :
Returns the full URL for the specified server-relative URL.
That’s great – but it raises some questions. What about Alternate Access Maps? What URL would be returned? Well, predictably, the URL used in the SPSite Constructor in the first place. Mostly, they either accept a URL (which defines a zone), or they accept a GUID and an SPUrlZone value. There is a constructor that just accepts a GUID – which will then use the default zone. Similarly, the constructor accepting a GUID and SPUserToken also uses the Default Zone.
(If you open it up in reflector, you can see it just calling a private constructor passing the SPUrlZone.Default value).
