try the following instruction
Uri myuri = new Uri(System.Web.HttpContext.Current.Request.Url.AbsoluteUri); string pathQuery = myuri.PathAndQuery; string hostName = myuri.ToString().Replace(pathQuery , "");
Example 1
Input : http://localhost:4366/Default.aspx?id=notlogin Ouput : http://localhost:4366
Example 2
Input : http://support.domain.com/default.aspx?id=12345 Output: support.domain.com
SiwachGaurav Jul 12 '14 at 5:59 a.m. 2014-07-12 05:59
source share