|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Tags inside value field of appsettings in web.configi need to write a xml data inside the value field in web.config file.
it looks likes this <configuration> <appSettings> <add key="MyXmlData" value="<data><type></type>........." /> </appSettings></configuration> but i get an error message some one help me You need to encode/escape the characters. You can do it manually if you
know all of the rules, but I wrote a little utility for myself that I know will do it right. I guess I should post the full app at some point, but the relevant method is: public string Encode(string input) { StringBuilder output = new StringBuilder(); using (StringWriter stringWriter = new StringWriter(output, CultureInfo.InvariantCulture)) { XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter); xmlWriter.WriteStartElement("element"); xmlWriter.WriteAttributeString("attribute", input); xmlWriter.WriteEndElement(); xmlWriter.Close(); } return output.ToString(); } Just create a simple WinForms app with a textbox to past a value into, a button that runs the Encode method, and then a textbox for the output (not label - you want to be able to select the output for copy/paste). Joshua Flanagan http://flimflan.com/blog
Other interesting topics
Net runtime crash
Looping through a filtered GridView converting a variable within a append document.forms string Arghh!!!! Button Not Firing. Losing data in a textbox on postback ASP.NET code to launch new browser session/window? Access is denied: 'Interop.ADODB' error - almost ready to jump off the balcony! Run IISRESET in an asp.net page? Pocket PC Emulator - connection problems Datalist w/ scroll |
|||||||||||||||||||||||