How to get the correct QueryString value from a URL that has a UNICODE value in asp.net?

I have a field with the nvarchar data type to store the UNICODE value. This field is tied to Repeater Control, from which I am redirected to another page when I click the link. When this field contains a numeric value in the field, then I get the correct QueryString and displays the redirect page. But, when it contains some unicode character (except for a number or an English character), then it shows the value "?????" in the QueryString of 'fhn'. How to get this UNICODE QueryString value as is and display the result?

In Repeater ItemTemplate:

<b>घर क्र./House No.</b><%# Eval("HouseNumber")%> <a href="AddressList.aspx?li=<%=Request.QueryString["li"].Trim().ToString() %>&fhn=<%# Eval("HouseNumber")%" target="_blank">या पत्यावरील </a> 

In the .cs file:

 string HouseNumber = Request.QueryString["fhn"].ToString().Trim(); 

// here I get '????' value if it contains a unicode value.

Help rate!

+4
source share
2 answers

Try changing it to something like this:

<!-- Web.Config Configuration File -->``<configuration> <system.web> <customErrors mode="Off"/> <globalization fileEncoding="iso-8859-1" requestEncoding="iso-8859-1"responseEncoding="iso-8859-1"/> </system.web> </configuration>

+1
source

You must be more accurate. You can set the encoding of the request and response in the web.config file:

 <system.web> <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" /> </system.web> 
+1
source

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


All Articles