Click here to Skip to main content
14,454,377 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am using this code to generate a xml from a dataset. but after writing this i get an error message. can anyone help me to solve this ?


XmlTextWriter xmlWriter = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);



error message:
The name 'Encoding' does not exist in the current context
Posted
Updated 5-Jul-11 2:51am
v2
Rate this:
Please Sign up or sign in to vote.

Solution 1

Try using System.Text.Encoding.UTF8
Check if reference exists to System.Text
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Add the following namespace:

using System.Text;
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 3

You can also put this into your .aspx.cs file.

using System.Text;


I don't know why none of the project templates include this (and System.IO) by default yet. I need both in practically every project I create.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100