You can prevent your website from xss using:
1. Validate Input received from your site.
2. Encode Output generated from your site.
www.codecollege.NET