<p>I am using a rich text editor on a web page.  .NET has feature that prevent one from posting HTML tags, so I added a JavaScript snippet to change the angle brackets to and alias pair of characters before the post. The alias is replaced on the server with the necessary angle bracket and then stored in the database.  With XSS aside, what are common ways of fixing this problem. (i.e. Is there a better way?)</p>

<p>If you have comments on XSS(cross-site scripting), I'm sure that will help someone.</p>

[{'answer_id': 61773, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>My first comment would be to avoid using JavaScript to change the angle brackets. Bypassing this is as simple as disabling JavaScript in the browser. Almost all server-side languages have some utility method that converts some HTML characters into their entity counterparts. For instance, PHP uses htmlentities(), and I am sure .NET has an equivalent utility method. In the least, you can do a regex replace for angle brackets, parenthesis and double quotes, and that will get you a long way toward a secure solution.</p>\n'}, {'answer_id': 61777, 'author': 'Kibbee', 'author_id': 1862, 'author_profile': 'https://Stackoverflow.com/users/1862', 'pm_score': 3, 'selected': True, 'text': '<p>There\'s actually a way to turn that "feature" off. This will allow the user to post whichever characters they want, and there will be no need to convert characters to an alias using Javascript.  See this article for <a href="http://mdid.org/mdidwiki/index.php?title=Disabling_Request_Validation" rel="nofollow noreferrer">disabling request validation</a>.  It means that you\'ll have to do your own validation, but from the sounds of your post, it seems that is what you are looking to do anyway.  You can also disable it per page  by following <a href="http://www.asp.net/learn/whitepapers/request-validation/" rel="nofollow noreferrer">the instructions here</a>.</p>\n'}, {'answer_id': 61778, 'author': 'Tyler', 'author_id': 5642, 'author_profile': 'https://Stackoverflow.com/users/5642', 'pm_score': 2, 'selected': False, 'text': '<p>I think the safest way to go is to NOT allow the user to create  tags with your WISYWIG. Maybe using something like a markdown editor like on this site or <a href="http://wmd-editor.com/" rel="nofollow noreferrer">available here.</a> would be another approach. </p>\n\n<p>Also keep the Page directive ValidateRequest=true which should stop  markup from being sent in the request, you\'ll of course need to handle this error when it comes up. People will always be able to inject  tags into the request either way using firefox extensions like <a href="https://addons.mozilla.org/en-US/firefox/addon/966" rel="nofollow noreferrer">Tamper data</a>, but the ValidateRequest=true should at least stop ASP.NET from accepting them.</p>\n\n<p>A straight forward post on XSS attacks was recently made by Jeff here. It also speaks to making your cookies HttpOnly, which is a semi-defense against cookie theft. Good luck!</p>\n'}]
['https://Stackoverflow.com/questions/61760', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2017/']