Application Error Handler can not get current Unicode Url

S

Steve

I am using IIS 5.1 with ASP.NET 1.1
I cannot get the correct url in the error handler in the global.asax.
My testing global.asax:
<%@ Application %>
<script language="C#" runat="server">
public void Application_Error()
{
Server.ClearError();
Response.Write(Request.RawUrl + "<br>");
Response.Write(HttpUtility.UrlDecode("%e4%b8%80"));
}
</script>

I tried url http://localhost/一.aspx
It's supposed to be "?" (a chinese character) in the url.
But I got /�.aspx in the Request.RawUrl.
I checked the IIS log and it logged the correct url in the log file.
Also HttpUtility.UrlDecode returns the correct url.

Thanks,
Steve
 
R

Rick Strahl [MVP]

It sounds like the page might have an invalid content type. Is the page
content type UTF-8 or UTF-16?

ASP.NET will pick up the content type from the page when doing its decoding.
In your case it looks like it's decoding the URL into a UTF8 string rather
than into a unicode string so you may have to 'double decode'. Try the UTF8
Encoder to decode the string you get back from UrlDecode.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top