Microsoft KB Archive/923707

From BetaArchive Wiki
Knowledge Base


FIX: Some characters in a text resource may not appear correctly when you try to embed the text resource in a Web application that is built on the .NET Framework 2.0

Article ID: 923707

Article Last Modified on 12/3/2007



APPLIES TO

  • Microsoft .NET Framework 2.0



SYMPTOMS

When you try to embed a text resource in a Web application that is built on the Microsoft .NET Framework 2.0, some characters in the text resource may not appear correctly. This problem occurs when you set the PerformSubstitution parameter of the WebResource attribute to True.

RESOLUTION

The following file is available for download from the Microsoft Download Center:

[GRAPHIC: Download]Download the .NET Framework 2.0 System.web.dll security update package now. For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to obtain Microsoft support files from online services


Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.

Note This update addresses a problem for text files that use the following encodings:

  • UTF-8 encoding
  • Other Unicode encodings that use a byte order mark (BOM) and are supported by the .NET Framework 2.0.

This update does not address a scenario in which the text resource is encoded by using an encoding that does not use a BOM, such as Windows-1252. We recommend that you do not use such encodings because browsers must then guess the encoding that is used. Therefore, results can be unpredictable.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

922770 MS06-056: Vulnerability in ASP.NET 2.0 could allow for information disclosure


Steps to reproduce the problem

  1. To embed a text resource in the application, add code that resembes the following code example.

    using System;
    using System.Collections.Generic;
    using System.Text;
    
    using System.Web.UI;
    using System.Net.Mime;
    
    [assembly: WebResource("CLResources.TextFile-Unicode.txt", MediaTypeNames.Text.Plain, PerformSubstitution = true)]
    [assembly: WebResource("CLResources.TextFile-UTF8-Signed.txt", MediaTypeNames.Text.Plain, PerformSubstitution = true)]
    [assembly: WebResource("CLResources.TextFile-Windows1252.txt", MediaTypeNames.Text.Plain, PerformSubstitution = true)]
    
    namespace CLResources
    {
        public class Class1
        {
        }
    }
  2. To use the resource in the application, add code that resembes the following code example.

    public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperLinkUnicode.NavigateUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(CLResources.Class1), "CLResources.TextFile-Unicode.txt");
            HyperLinkUtf8.NavigateUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(CLResources.Class1), "CLResources.TextFile-UTF8-Signed.txt");
            HyperLinkWindows1252.NavigateUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(CLResources.Class1), "CLResources.TextFile-Windows1252.txt");
            
        }
    }
  3. Run the application.


Keywords: kbfix kbqfe kbresource kbstring kbdisplay KB923707