--- title: "Preventing JavaScript Injection Attacks | Microsoft Docs" author: StephenWalther description: "Prevent JavaScript Injection Attacks and Cross-Site Scripting Attacks from happening to you. In this tutorial, Stephen Walther explains how you can easily de..." ms.author: aspnetcontent manager: wpickett ms.date: 08/20/2008 ms.topic: article ms.assetid: 012a91e7-fd88-4d4f-8f95-57a9043c47d9 ms.technology: dotnet-mvc ms.prod: .net-framework msc.legacyurl: /mvc/videos/mvc-2/how-do-i/preventing-javascript-injection-attacks msc.type: video --- Preventing JavaScript Injection Attacks ==================== by [Stephen Walther](https://github.com/StephenWalther) Prevent JavaScript Injection Attacks and Cross-Site Scripting Attacks from happening to you. In this tutorial, Stephen Walther explains how you can easily defeat these types of attacks by HTML encoding your content. For additional information about this video, read the "Preventing JavaScript Injection Attacks" tutorial ([C#](../../../overview/older-versions-1/security/preventing-javascript-injection-attacks-cs.md), [VB](../../../overview/older-versions-1/security/preventing-javascript-injection-attacks-vb.md)). [▶ Watch video (11 minutes)](https://channel9.msdn.com/Blogs/ASP-NET-Site-Videos/preventing-javascript-injection-attacks) >[!div class="step-by-step"] [Previous](an-introduction-to-url-routing.md) [Next](creating-unit-tests-for-aspnet-mvc-applications.md)