13
You can use HttpUtility instead, which has a static method that does not depend on HttpContext.
string myString = HttpUtility.HtmlEncode("my link & details");
HtmlEncode isn't a static method, and requires an instance of HttpServerUtility to call. Since HttpContext.Current.Server is a HttpServerUtility instance, you can instead use;
string myString = HttpContext.Current.Server.HtmlEncode("my link & details");