public SettingsViewModel() { if (HttpContext.Current != null) { // Default the site's url using the current request Uri uri = HttpContext.Current.Request.Url; string port = ""; if (uri.Port != 80 && uri.Port != 443) port = ":" + uri.Port; SiteUrl = string.Format("{0}://{1}{2}", uri.Scheme, uri.Host, port); } else { SiteUrl = "http://localhost"; } }