In SharePoint Web application each application can be associated with a collection of mappings between internal and public URLs. And a public URL is what users’ type to get to the SharePoint site. We can create 5 zones, and each zone represented by different web sites in IIS having single public URL.
Some time it requires getting web site’s public URL Programmatically and this is a small tip which revels if you know the zone information then you can easily get the public URLs by passing it to GetResponseUri method which returns the absolute root of the URI.
SPContext currContext = SPContext.Current;
string strInternetURL = currContext.Site.WebApplication.GetResponseUri(Microsoft.SharePoint.Administration.SPUrlZone.Internet).AbsoluteUri;