Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 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 1:51am
v2

Try using System.Text.Encoding.UTF8
Check if reference exists to System.Text
 
Share this answer
 
Add the following namespace:

C#
using System.Text;
 
Share this answer
 
v2
You can also put this into your .aspx.cs file.

C#
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900