String value of the query string containing "&"

I have a query string like

www.google.com?Department=Education & Finance&Department=Health

I have tags li, and their query string looks like this:

  • Education and Finance
  • Health

Now the problem is that I am doing a NamevalueCollection and getting all the key values: this only gives me education, not finances .....

Any idea how to do this?

+3
source share
3 answers

You need to encode your values ​​by calling Server.UrlEncodebefore placing them in the URL.

If your values ​​are in an array, you need to use a loop. If you need accurate instructions, you will need to show us your current code.

+8

(&) URL-. , URL- www.google.com : 2 .

:

System.Web.HttpUtility.UrlEncode(string url) 

URL.

+6

URL. &, & . , URL-, .

Education & Finance + %20, & %26, Education%20%26%20Finance.

, URL :

www.google.com?Department=Education%20%26%20Finance&Department=Health
+3

Source: https://habr.com/ru/post/1734247/


All Articles