Skip to main content

Posts

Showing posts with the label Prevent XSS ASP NET MVC - Cross Site Scripting

Allow User to input HTML in ASP.NET MVC - ValidateInput or AllowHtml

What Is Cross Site Scripting (XSS) Attack? The Cross Site Scripting (XSS) attack is a type of injection and attackers inject your web applications using the client side scripts and malicious code into web pages. An attacker can insert vulnerability scripts and malicious code in your web applications. The Cross Site Scripting (XSS) attacks are common on web browsers and it carried out on websites around 84% (approximately). How To Prevent an ASP.NET MVC Apps? In ASP.NET MVC by default Cross Site Scripting (XSS) attack is validated and if any one of you tries to post JavaScript/HTML and other XSS attacks code in the database. It will return an error i.e. What About [AllowHtml] Attribute Property? The AllowHtml attribute is used to allow a request to sending HTML/JavaScript codes to server which be applied to a Model property to disable the validation. The AllowHtml attribute is developed for View Model class with limited Scope and its safe and recomme...