• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

How to get Unicode characters from Request in ASP.NET?

On my current project my asp.net 2.0 application gets called using a url which contains unicode characters. For example: somepage.aspx?p=Möll
When I try to get the text from the Request object:
string t = Request["p"];
The result (t) does not contain the "ö" character althought the Request.RawUrl property does contain the correct character.

Does anybody know how to get the correct unicode characters from the request object?
0
verhart
Asked:
verhart
  • 2
1 Solution
 
Munawar HussainPrincipal Software EngineerCommented:
hi,
you may use encoding and decoding to pass such data .
kindly check this reply .. I have alreay answered almost same qestion .. hope it would help you

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22941958.html

thanks
0
 
verhartAuthor Commented:
I don't think this is going to work; I have no control over the calling application: it just adds the characters to the url that calls my page. But I'll give it a try later today.

My solution for now is the following, but it doesn't feel 'right' though.
string t = System.Text.RegularExpressions.Regex.Match (Request.RawUrl, "&p=.*&").Value;
if (t == "")
{
t = System.Text.RegularExpressions.Regex.Match(Request.RawUrl, "&p=.*&").Value;
}

Open in new window

0
 
verhartAuthor Commented:
Oeps, should be:
string t = System.Text.RegularExpressions.Regex.Match (Request.RawUrl, "&p=.*&").Value;
if (t == "")
{
t = System.Text.RegularExpressions.Regex.Match(Request.RawUrl, "&p=.*").Value;
}

Open in new window

0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now