Request.ApplicationPath will work only IE. When we want to support different browsers like Chrome, Safari and Firefox, we should use the below property to get the correct relative URL.
If we use Request.ApplicationPath
If we use Request.Url.GetLeftPart(UriPartial.Authority), then it will be rendered as
http://ServerName/abc/testpage.aspx?x=1
this.Request.Url.GetLeftPart(UriPartial.Authority)Example:
If we use Request.ApplicationPath
window.open('" + Request.ApplicationPath + "/abc/testpage.aspx?x=1"','test page', 'toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes ,modal=yes'); }", true);It will be rendered as http://abc/testpage.aspx?x=1
If we use Request.Url.GetLeftPart(UriPartial.Authority), then it will be rendered as
http://ServerName/abc/testpage.aspx?x=1
string navigatePath = HttpContext.Current.Request.Url.AbsolutePath;
ReplyDeletenavigatePath += "/abc/testpage.aspx?x=1";