I am trying to use HttpUtility.HtmlEncode to encode the underscore in% 5f, but the encoded value does not give me a hexadecimal representation. How do i do this?
string encodedValue = HttpUtility.HtmlEncode("First_Name");
The value I want in the encodedValue line is "First% 5FName".
Is there something I am missing? I also tried using HttpUtility.UrlEncode, but that also does not give me the desired result.
I know that this should be something simple, but I cannot get around it.
source share