ASP. NET webpage cannot download file posts with Chinese names)

Source: Internet
Author: User

The website I deployed today has a headache for a long time. I tested it normally on my computer, but I only knew it after I checked it. I hope this article will be helpful to you.

 

When a Chinese character is used in the URL and file name, IIS reports the 404 error. The page cannot be found. Check the program directory structure and find that everything is normal.

If your server is not IIS and the browser is IE, use the default settings ~~ Webpages with Chinese names cannot be accessed.
The reason is that IE converts Chinese to UTF-8, but currently only IIS can recognize it

Solution:

Method 1:

1. Change the Registry
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ inetinfo \ Parameters \ favordbcs
Change the value to 0.

2. restart the computer.

Method 2:

Self-control in the program

'Convert two-byte characters into valid URL transmission strings

Function geturlencodel (byval URL)
Dim I, code
Geturlencodel = ""
If trim (URL) = "" Then exit function
For I = 1 to Len (URL)
Code = ASC (mid (URL, I, 1 ))
If Code <0 then code = code + 65536
If code & gt; 255 then
Geturlencodel = geturlencodel & "%" & left (hex (CODE), 2) & "%" & right (hex (CODE), 2)
Else
Geturlencodel = geturlencodel & Mid (URL, I, 1)
End if
Next
End Function

Method 3:

First in IE tools-Internet Options-advanced, always remove the hooks in the box before the URL is sent in UTF-8

Method 4:

Do not use Chinese file names

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.