If you do not clear what the user places in the text field and submits, then yes, there is a chance of harm.
You might want to check out the Microsoft Anti-Cross Site Scripting Library , as it is designed to help developers prevent such attacks.
It's also worth taking a look at OWASP Cross-Site Scripting (XSS)
You might want to look at HttpUtility.HtmlEncode and HttpUtility.HtmlDecode. I just wrote a quick test, and it looks like this might affect your concern in the comment below (on how to display data for other users in the correct format):
string htmlString = "<b>This is a test string</b><script>alert(\"alert!\")</script> and some other text with markup <ol><li>1234235</li></ol>"; string encodedString = HttpUtility.HtmlEncode(htmlString); // result = <b>This is a test string</b><script>alert("alert!")</script> and some other text with markup <ol><li>1234235</li></ol> string decodedString = HttpUtility.HtmlDecode(encodedString); // result = <b>This is a test string</b><script>alert("alert!")</script> and some other text with markup <ol><li>1234235</li></ol>
ASP.NET and HTMLEncode Controls I was going to publish the information I received from my class, but found a link that lists the same (for versions 1.1 and 2.0), so I will send the link for a more convenient link. You can probably get more information about a specific control that is not listed (or version 3.0 / 3.5 / 4.0 if they were changed) by looking at MSDN, but this should serve as a minimum for you to get you started. Let me know if you need more information and I will see what I can find.
ASP.NET default HTML controls
Here is a more complete list from one of the MSDN blogs: Which automatic ASP.NET codes are automatically encoded?
source share