I am using mysql with asp.net to save data in DB . When I save data in DB after using server.HTMLEncode(), the data is saved after removing \ . This is how I am saving data
INSERT INTO Users(ID,Name) Values(1,Server.HTMLEncode(User.Identity.Name))
In this case if name is XXX\ABC , it is being saved as XXXABC. Slashes are removed while saving in DB.
Next time when I read the same , I need to check if logged in user is the one against whom I saved data so I do following
if ( existingRowEditor == Server.HtmlEncode(User.Identity.Name))
{
}
but the issue is that the above condition is always false because I have following values
existingRowEditor="XXXABC" and Server.HtmlEncode(User.Identity.Name) =XXX\\ABC.
So how can I check if the above condition is true?