Or encoding. Recently, I am dealing with encoding-_-: questions about post data to ASP. NET pages on ASP pages

Source: Internet
Author: User
What is the impact of encoding on post data from ASP pages to Asp.net pages?
I talked to people about this on a BBS. Although it is very simple, I think there are still issues that many people have not noticed. I will post them for reference, the same should be true for post on HTML pages.

Yovav
: Do u think it's possible that codePage is "lost" when posting data from ASP to an ASP. NET page?

SAMUEL: to your question"Do u think it's possible that codePage is" lost "when posting data from ASP to an ASP. NET page? ", I think it's not possible ---
It's really truth.

When posting data from ASP to ASP. NET page, the codePage will automatically be changed into UTF-8.

Therefor, you 'd better set your ASP. NET page's codePage/charset correctly.

Yovav: How can I traslate this to ASP. NET (or at least define the codePage )?

<% @ CodePage = "1252" %>

<%
Session. codePage = 1252 'impant ant: syncronize with the server code page
Response. charset = "UTF-8" 'important: Make the server respond with correct charset
%>

Thanks again.
My form is now posting correctly-thanks to you

SAMUEL: From your code, I found that you want dynamic codePage/charset for response. Is it?

For dynamic response in ASP. NET, put the follow code inPage_load ()Event of. CS/. VB file:

 
Session. codePage = 1252
Response. charset = "UTF-8 ";

For static response, modify. aspx file like this:

 
<% @ Page Language = "C #" codebehind = "aspnetpage1.aspx. cs" autoeventwireup = "false"
Inherits = "aspposttoasp. net. webform1"CodePage = "1252"%>
...
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">

If you used session and response object to set codePage/charset, the defined value in. aspx file will be invalid.

It seems that codePage of UTF-8 is 65001 against 1252 in ASP. NET.

Yovav: I thought I shoshould do it like this,

So the only solution for me is to use your great two conversion functions

Great job! -I'm sure that a lot of people don't have a clue how to deal with this problem...

Related Article

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.