Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string GetSiteRoot()
- {
- var port = HttpContext.Current.Request.Url.Authority;
- var protocol = HttpContext.Current.Request.Url.Scheme;
- var sOut = protocol + "://" + port + "/" + HttpContext.Current.Request.ApplicationPath;
- if (sOut.EndsWith("/"))
- sOut = sOut.Substring(0, sOut.Length - 1);
- var sOut = protocol + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + port +
- HttpContext.Current.Request.ApplicationPath;
- if (sOut.EndsWith("/"))
- {
- sOut = sOut.Substring(0, sOut.Length - 1);
- }
- return sOut;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement