Anti XSS Library in ASP.NET MVC

In this previous article you had read about XSS attack. Now i am to explain an Anti XSS library from Microsoft to prevent XSS attack.

Anti XSS Library

                Someone come to a form and enter some script like below


It’s also more malicious. Fortunately Microsoft provide a library for prevent this. You can download it via nugget or Library Package Manager Console (Visual Studio>>Tools>>Library Package Manager>>Package Manager Console and type Install-Package AntiXSS and press enter).

                What I am going to do I am putting a line of code in the below Edit action post method


And this code will remove all the malicious things


Hope you are enjoying my article…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s