<% string url = System.Web.HttpContext.Current.Request.Url.ToString(); if(url.Contains("?")) { url = url.Substring(0, url.IndexOf("?")); } %>