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
The following file is available for download from the Microsoft Download Center:
Download the .NET Framework 2.0 System.web.dll security update package now.
Collapse this imageExpand this image
For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
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.
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.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
MS06-056: Vulnerability in ASP.NET 2.0 could allow for information disclosure
Steps to reproduce the problem
- To embed a text resource in the application, add code that resembes the following code example.
[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)]
public class Class1
- 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");
- Run the application.
Article ID: 923707 - Last Review: December 3, 2007 - Revision: 1.1
- Microsoft .NET Framework 2.0
|kbfix kbqfe kbresource kbstring kbdisplay KB923707|