How can I have the lynx plain text reader fetch the ASP. NET web pages of the UTF-8?

Source: Internet
Author: User

Requirement for people with physical and mental disabilities

In China, many people with physical and mental disabilities use lynx, because our company is building a network without any problems recently, just think of the UTF-8's website which could not make these physically and mentally impaired people use our website services, I felt that I was tempted to solve this problem quickly!

ASP. NET 2.0 developers who need to work as a fault-free website

I think most of them are Asp. NET developers do not understand the Linux operating system. The only way to use the lynx OS is to use the cygwin + Lynx OS on a Windows host, however, today I have developed the most simple, easy, and time-saving way to make your asp. net website server to see the use of Lynx on the network of the publisher, changed to the big5 way back to export the character set!

Solution

In ASP. NET 2.0 adds a special resource called app_browsers, Asp. net will use these cases to identify a different operator and determine their functions and response methods.

You only need to create this project in your web application root project and create a lynx. Browser case. The content in this case is as follows:

[Code: HTML]
<! -- You can find existing browser definitions at <WINDIR> \ Microsoft. Net \ framework \ <ver> \ config \ browsers -->
<Browsers>
<Browser id = "Lynx" parentid = "default">
<Identification>
<Useragent match = "Lynx/\ D + \. \ D +"/>
</Identification>
<Capture>
<Useragent match = "Lynx /(? 'Version '(? 'Browsermajorversion' \ D + )\.(? 'Browserminorversion' \ D +) "/>
</Capture>
<Capabilities>
<Capability name = "Browser" value = "Lynx"/>
<Capability name = "version" value = "$ {version}"/>
<Capability name = "majorversion" value = "$ {browsermajorversion}"/>
<Capability name = "minorversion" value = "$ {browserminorversion}"/>
<Capability name = "preferredrequestencoding" value = "big5"/>
<Capability name = "preferredresponseencoding" value = "big5"/>
</Capabilities>
</Browser>
</Browsers>
[/Code]

 

Just click it!In this case, as long as your website is connected to the lynx browser, it can be "automatically" converted to big5 shopping festival!I really appreciate the beautiful web development architecture of ASP. NET!

Attention

  • If the following meta tag is used in your website, remove it:

    [Code: HTML]
    <Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
    [/Code]

  • And add the following program into the page_load event of your masterpage or Page code behind:

    [Code: C #]
    Public partial class masterpage: system. Web. UI. masterpage
    {
    Protected void page_load (Object sender, eventargs E)
    {
    Htmlmeta metacontenttype = new htmlmeta ();
    Metacontenttype. httpequiv = "Content-Type ";
    If (request. browser. browser = "Lynx ")
    {
    Metacontenttype. content = "text/html; charset = big5 ";
    }
    Else
    {
    Metacontenttype. content = "text/html; charset = UTF-8 ";
    }

    Page. header. Controls. addat (0, metacontenttype );
    }
    }
    [/Code]

  • In addition, if an external hacker in your website is logged in (*. CSS or *. JS), if the case is to use a UTF-8 character with non-ASCII characters in the content, it may also cause a problem in the use of big5 character! However, lynx does not support CSS and JavaScript, so it's okay! But who knows that later Lynx versions will not support these features!

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.