Webapi self host crashes when the HTTP request header contains unencoded Chinese Characters

Source: Internet
Author: User

Recently, ISO APIs have been developed, and web API self host is used as the server. for iOS requests, asihttprequest is used for http get requests. Once a request is sent, an error occurs on the server and cannot be captured using filter.

After debugging, it was found that the User-Agent in the HTTP request header was running, and its value was actually a bunch of strange characters: "commandid § ç ?? 1.0 iPod Touch; iPhone OS 5.0.1; ZH-CN ";

After the Custom User-Agent is a pure English character,ProgramIf the HTTP header contains unencoded Chinese characters, an exception is thrown when the web API is running.

Currently, there is no solution for capturing this exception on the server. Which of the following experts knows how to handle the exception and ask for help?

========================================================== ==========================================

Latest discoveries

I posted a help post on the official Asp.net Forum. After some interaction, I found that this bug could not be reproduced in the English operating system.

So after I modify the "non-Unicode program language" of the operating system locally to English, the program will not crash, indicating that this problem is related to encoding.

No other solutions available currently

 

========================================================== ============

It is determined to be an RC bug. You can refer to my post on the official Asp.net forum.

Self Host application running on non-Unicode OS can be easily broken by sending a header value with invalid character

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.