SHEKHAR SHETE
SHEKHAR SHETE

Reputation: 6056

How to get Correct QueryString Value from URL having UNICODE value in asp.net?

I have a field with nvarchar datatype to store UNICODE value. This field is bound to Repeater Control from which i am redirecting to other page on clicking the link. When this field contains the numeric value in field then, i get the correct QueryString and it displays the Redirected page. But, When it contains some unicode charater(Other than Number or English Character) then it show the value '?????' in QueryString of 'fhn'. How to get this UNICODE QueryString value as it is and display 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 .cs file:

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

//here i get the '????' value if it contains unicode value.

Help appreciated!

Upvotes: 4

Views: 3110

Answers (2)

Imran Rizvi
Imran Rizvi

Reputation: 7438

You'll have to be a more precise. You could set request and response encoding in your web.config file:

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

Upvotes: 1

JayOnDotNet
JayOnDotNet

Reputation: 398

Try changing it to something more 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>

Upvotes: 1

Related Questions