Encoded data is getting decoded automatically while binding it with ASP.NET controls


I am encoding malicious characters while saving it to DB.

But these encoded text is getting decoded again while binding it with controls like LoginView, Repeater.

e.g. Suppose encoded text is < then while binding it with controls like repeater, loginview it is getting decoded to “<” i.e. the original string.

Is it default behaviour of ASP.NET controls?

Is there any solution to avoid decoding?



.NET Foundation Website | Blog | Projects | Code of Conduct