I have a class library (in C#). I need to encode my data using the HtmlEncode method. This is easy to do from a web application. My question is, how do I use this method from a class library that is being called from a console application?
Import System.Web Or call the System.Web.HttpUtility which contains it
You will need to add the reference to the DLL if it isn't there already
string TestString = "This is a <Test String>.";
string EncodedString = System.Web.HttpUtility.HtmlEncode(TestString);