DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 923707 - Last Review: December 3, 2007 - Revision: 1.1

On This Page

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:

Collapse this imageExpand this image
Download
Download the .NET Framework 2.0 System.web.dll security update package now. (http://www.microsoft.com/downloads/details.aspx?familyid=34C375AA-2F54-4416-B1FC-B73378492AA6&displaylang=en) 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  (http://support.microsoft.com/kb/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  (http://support.microsoft.com/kb/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(http://services.support.microsoft.com/typeof(CLResources.Class1), "CLResources.TextFile-Unicode.txt");
            HyperLinkUtf8.NavigateUrl = this.Page.ClientScript.GetWebResourceUrl(http://services.support.microsoft.com/typeof(CLResources.Class1), "CLResources.TextFile-UTF8-Signed.txt");
            HyperLinkWindows1252.NavigateUrl = this.Page.ClientScript.GetWebResourceUrl(http://services.support.microsoft.com/typeof(CLResources.Class1), "CLResources.TextFile-Windows1252.txt");
            
        }
    }
    
  3. Run the application.

APPLIES TO
  • Microsoft .NET Framework 2.0
Keywords: 
kbfix kbqfe kbresource kbstring kbdisplay KB923707
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support