Microsoft Knowledge Base Email Alertz

(835385) - Explains that some characters may no longer appear when you pass data from a Web page to a Web form. This article provides two possible resolutions for this problem.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 835385 - Last Review: May 18, 2007 - Revision: 1.4

Certain characters disappear when you receive data that you pass by using the POST request from an ASP Web page or from an HTML Web page

On This Page

SYMPTOMS

In a Microsoft ASP.NET Web form, when you receive data that you pass by using the POST request from an Active Server Pages (ASP) Web page or from an HTML Web page, certain characters may disappear. For example, if you pass BeginãøåöäéEnd from an ASP Web page or from an HTML Web page, in the ASP.NET Web form, you may receive only BeginEnd.

CAUSE

HMTL Web pages, ASP Web pages, and ASP.NET Web forms use character sets to represent characters. When you pass data to an ASP.NET Web form, if the data is in the format of a character set that the Web form uses, the Web form can receive the data. However, if the ASP Web page or the HTML Web page that sends the data uses a different character set than the character set that the Web form uses, the behavior that is mentioned in the "Symptoms" section of this article occurs.

RESOLUTION

To resolve this problem, use one of the following methods. If you do not know the character set that your Web page uses, Microsoft recommends that you change the character set that the Web page uses.

Change the character set that the Web page uses

Change the character set that the Web page uses to the character set that the Web form uses. To do this, follow these steps:
  1. In the Web.config file of your ASP.NET Web Application project, locate the <globalization> element. Note the value for the requestEncoding attribute of the <globalization> element.
  2. In your ASP Web page or in your HTML Web page, locate the following code:
    <title>PageTitle</title>
    Note PageTitle is a placeholder for the title of your Web page.
  3. Add the following code after the code that you located in the previous step.

    Note In the following code, replace CharacterSet with the value that you noted in step 1.
    <meta http-equiv="Content-Type" content="text/html; charset=CharacterSet">

Change the character set that the Web form uses

Change the character set that the Web form uses to the character set that the Web page uses. To do this, follow these steps:
  1. Note the character set that the Web page uses. If you do not know the character set that the Web page uses, locate the META element for the Web page, and then note the value for the charset property of the associated CONTENT attribute.

    Note The META element is an optional element. Therefore, your Web page may not contain a META element. In such a scenario, this resolution may not resolve the problem.
  2. In the Web.config file of your ASP.NET Web Application project, locate the <globalization> element.
  3. Change the values for the requestEncoding attribute and the responseEncoding attribute to the value that you noted in step 1. If you did not note any value in step 1, change the values for the requestEncoding attribute and the responseEncoding attribute to typical values (such as "ISO-8859-1" and "Windows-1252").

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

  1. Start Microsoft Visual Studio .NET.
  2. Use Microsoft Visual Basic .NET to create an ASP.NET Web Application project. By default, the WebForm1.aspx file is created.
  3. Add a Label control to the WebForm1 Web form.
  4. Add the following code to the Page_Load event handler for the WebForm1 Web form:
    Label1.Text = Request.Form("postdata")
  5. Add an HTML Web page to the project.
  6. In Solution Explorer, right-click the Web page that you added in the previous step, and then click Set As Start Page.
  7. In the HTML View of the Web page, add the following code to the BODY element:
    <form action="WebForm1.aspx" method="post" ID="Form1">
    <p><input type="text" name="postdata" ID="Text1"></p>
    <input type="submit" value="Post" ID="Submit1" NAME="Submit1">
    </form>
  8. Build the project.
  9. In Solution Explorer, right-click the Web page, and then click View in Browser.
  10. In the text box, type the following text:

    BeginãøåöäéEnd
  11. Click Post.
  12. The WebForm1 Web form appears with the following text:
    BeginEnd
    Notice that certain characters have disappeared.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/en-us/library/hy4kkhe0(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/hy4kkhe0(vs.71).aspx)
For additional information, visit the following Web site:
http://www.w3.org/TR/html4/charset.html (http://www.w3.org/TR/html4/charset.html)
Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

APPLIES TO
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
Keywords: 
kbwebforms kbhtml kbprb KB835385
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate