How  and 65279 and Other Byte Order Marks (BOM) Can Mess Up Your XML

4 Comments »

When you download XML text from the Web, you may find “garbage characters” in the start of your XML string.  For example, I encountered this result when I downloaded an XML string using WebClient.DownloadString method:

<Root><Item>Hello, World</Item></Root>

What you are likely seeing is a Byte Order Mark (BOM), which is a Unicode character that indicates the endian-ness (byte order) of a text file or stream.  The BOM is optional and will appear at the start of the text stream, if at all.  The BOM may also indicate in which of the several Unicode representations the text is encoded.

Read the rest of this entry »

Blogs from Microsoft C# Development Team

No Comments »

Want insight into the design and development of C#?  Then check out these blogs by key members of the Microsoft C# development team:

Read the rest of this entry »

Format String for XML Value

3 Comments »

Of course you know that XML denotes element names with greater-than and less-than symbols, such as:

<name>value</name>

Therefore, to avoid confusing the XML parser, the greater/less symbols (and the ampersand, an HTML special character) must be encoded.

Read the rest of this entry »

Executing Code in Partial Trust Environments

9 Comments »

When building your first .NET web service, you may be in for a rude awakening when you discover the concept of “partial trust.” Your previously bullet-proof code will suddenly fail in a flurry of exceptions thrown by seemingly innocuous commands such as reading files or accessing the Registry. This article provides a brief overview of Code Access Security and describes how to modify and test your code to work in a partial trust environment.
Read the rest of this entry »

Best C# Web Sites

24 Comments »

Recently I posted a list of the Best C# Blogs. Today we recognize the best C# Web sites.

Following (in alphabetical order) are the best C# sites active on the Web today. Also included is the “About” section of the site (edited for space and clarity). Please comment if you can recommend other excellent C# web sites that didn’t make my list.

Read the rest of this entry »

Read a Web Page in C#

9 Comments »

Reading the contents of a web page is easy in C# with the System.Net.WebClient class:

Read the rest of this entry »

Determine Installed .NET Versions from a Web Page

4 Comments »

You can use the following JavaScript code in a web page to determine which versions of .NET are installed on a client PC:

Read the rest of this entry »