Tuesday, June 22, 2010

ASP Getting server variables

//// Load ServerVariable collection into NameValueCollection object.


//coll = Request.ServerVariables;

//// Get names of all keys into a string array.

//String[] arr1 = coll.AllKeys;

//for (loop1 = 0; loop1 < arr1.Length; loop1++)

//{

// Response.Write("Key: " + arr1[loop1] + "
");

// serverVariable.Append("Key: " + arr1[loop1] + ": ");

// String[] arr2 = coll.GetValues(arr1[loop1]);

// for (loop2 = 0; loop2 < arr2.Length; loop2++)

// {

// Response.Write("Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "
");

// //serverVariable.Append("Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "\n");

// }

//}

Friday, June 4, 2010

Serialize with Stylesheet

Copied from http://stackoverflow.com/questions/1461029/possible-to-add-a-xslt-stylesheet-to-a-serialized-xml-document

XmlSerializer s = new XmlSerializer(typeof(myObj));


using (XmlWriter w = XmlWriter.Create(@"c:\test.xml"))

{

w.WriteProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"USED-FILE.xsl\"");

s.Serialize(w, myObj);

}