title: How to prevent XSS attacks in ASP.NET Core Razor view?
body: <p>In some part of my <code>.cshtml</code> file, I should render <code>Html</code> that users entered with <code>Html-Editor</code>.</p>
  <p>My code is :</p>
  <pre><code>&lt;div id=&quot;description&quot;&gt;
      @Html.Raw(Model.Html)
  &lt;div&gt;
  </code></pre>
  <p>but <code>@Html.Raw()</code> is not safe from <code>XSS Attacks</code> for example if user's entered Html content was something like this :</p>
  <pre><code>&quot;&lt;script&gt;alert('XSS attack!')&lt;/script&gt;&quot;
  </code></pre>
  <p>this script run after entering this page!</p>
  <p>how can I prevent from running these scripts(in general XSS attack) while rendering Html ?</p>