1

I have had an aspx project dumped on my lap and I have the following issue.

They are calling a function within the NavigateUrl of a hyperlink and the '&'s are being encoded

href="/products/automotive-glass/?position=whatever&brand=whatever"

but when clicked this encoding is shown in the address bar. Then when I try and get the value of the query string parameter

<asp:QueryStringParameter Name="brand" QueryStringField="brand" />

to pass to a function it does not find it because the parameters name is actually amp;brand

Is there a way to either not include the encoding in the address bar or a way of getting the parameter value with the encoding?

Cal
  • 55
  • 1
  • 6

1 Answers1

0

Use the built in static class utility methods HttpUtility.UrlEncode and HttpUtility.UrlDecode to encode and decode the Url. You'll need a reference to System.Web in order to use them. Here is a link to some documentation: https://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode(v=vs.110).aspx

TrevorBrooks
  • 3,590
  • 3
  • 31
  • 53