I have a href which gets filled in by reading a property from a database like this
lblName.HRef = user.PublicSiteUrl;
I want to safely encode this URL to protect against any persisted XSS attack.
Which encoding should be useful for this without causing any issues with the URL structure?
For example, if I have this URL coming from the database https://google.com?q=<SCRIPT>alert(“Cookie”+document.cookie)</SCRIPT>
..How Do i make this URL safe so the script is not executed as part of URL