I am trying to get query string from url With this code:
this.site_query = Request.Url.Query;
When I have get url:
http://localhost:1751/ar/search?q=سيارة
It gives me blow output in code:
http://localhost:1751/ar/Search?q=%D8%B3%D9%8A%D8%A7%D8%B1%D8%A9&Location=%D8%A3%D8%A8%D9%87%D8%A7,Abha
But I need Arabic text that I send in query string. When query string contains text in English then in c# it is correct.
There is nothing wrong with the second URL you have shown in your answer, it's just being URL encoded due to the limitations of what characters are allowed in URLs.
If you wish to get parts of the query string in code, you can use code like this:
var query = Request.QueryString["q"];
Additionally, if you are building your URLs in code, you should always URL encode and values that may contain non standard characters:
var urlEncodedValue = HttpUtility.UrlEncode(someValue);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With