Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, tutorials, and more.

Preventing cross-site injection using the anti-XSS library

Cross-site scripting
(XSS) is the process of injecting HTML or JavaScript fragments into a website. When these fragments are executed, they can do anything from redirecting the user to another site without his/her knowledge to accessing the cookies of the user and thus hijacking his/her session. Developers have been using the anti-XSS library for .NET to safeguard their websites from XSS. With Version 4.5, .NET has incorporated the anti-XSS library into ASP.NET.

In this recipe, we will develop a page for entering comments and displaying it. We will use anti-XSS functionality to make the comment display page safe from SS.

How to do it...

Launch Visual Studios 2012.

Create a project of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.