Skip to content

Instantly share code, notes, and snippets.

@KennethanCeyer
Created June 10, 2016 01:47
Show Gist options
  • Save KennethanCeyer/24b9fa87d0f2145e0ebf95d90a2c0c19 to your computer and use it in GitHub Desktop.
Save KennethanCeyer/24b9fa87d0f2145e0ebf95d90a2c0c19 to your computer and use it in GitHub Desktop.
protected override void Initialize(RequestContext requestContext)
{
base.Initialize(requestContext);
string domain = Dns.GetHostEntry(this.Request.UserHostName).HostName;
string[] segments = domain.Split('.');
string subdomain = "";
if(segments.Length >= 3)
{
subdomain = segments[0];
if(subdomain != "www")
{
Session["company_entry"] = subdomain;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment