I have three query strings (querystring1=100, querystring2=A&B, querystring3=300) and the URL is showing as http://mywebsite.com?querystring1=100&querystring2=A%26B&querystring3=300. (The querystring2 “A&B” is encoded as “A%26B”). It is returning the data correctly and no issues so far. However, my ExportToExcel method which has
Response.Write("<script>window.open('" & Request.Url.ToString & "&excel=true&PageSize=" & TotalRecs.ToString() & "','_new', '');
history.go(-1);
</script>")
is not working correctly because the querystring2 in URL is decoded to “A&B” when the page is rendered i.e. http://mywebsite.com?querystring1=100&querystring2=A&B&querystring3=300&excel=true&PageSize=3. It is taking querystring value as “A” instead of “A&B”. Can someone tell me how to fix this issue?
Use
Server.UrlEncodehttp://msdn.microsoft.com/en-us/library/zttxte6w.aspx