Skip to content

Commit 0b092c6

Browse files
991761: Replace obsolete Class used in CSP
1 parent 1fba9e7 commit 0b092c6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ej2-asp-core-mvc/common/EJ2_ASP.NETCORE/content-security-policy.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ app.Use(async (context, next) =>
3232
byte[] nonceBytes = new byte[32];
3333
RandomNumberGenerator.Fill(nonceBytes);
3434
string nonceValue = Convert.ToBase64String(nonceBytes);
35-
context.Items.Add("ScriptNonce", nonceValue);
35+
context.Items.Add("Nonce", nonceValue);
3636
context.Response.Headers.Add("Content-Security-Policy", string.Format(
3737
"script-src 'self' 'nonce-{0}' https://cdn.syncfusion.com;" +
3838
"style-src-elem 'self' 'nonce-{0}' https://cdn.syncfusion.com https://fonts.googleapis.com;" +
@@ -51,8 +51,10 @@ app.Use(async (context, next) =>
5151
{% highlight c# tabtitle="~/_Layout.cshtml" %}
5252
<head>
5353
...
54+
<!-- Syncfusion ASP.NET Core controls styles -->
55+
<link href="https://cdn.syncfusion.com/ej2/{{ site.ej2version }}/bootstrap5.css" nonce="@Context.Items["Nonce"]" rel="stylesheet" />
5456
<!-- Syncfusion ASP.NET Core controls scripts -->
55-
<script src="https://cdn.syncfusion.com/ej2/{{ site.ej2version }}/dist/ej2.min.js" nonce="@Context.Items["ScriptNonce"]"></script>
57+
<script src="https://cdn.syncfusion.com/ej2/{{ site.ej2version }}/dist/ej2.min.js" nonce="@Context.Items["Nonce"]"></script>
5658
</head>
5759
{% endhighlight %}
5860
{% endtabs %}
@@ -64,7 +66,7 @@ app.Use(async (context, next) =>
6466
<body>
6567
...
6668
<!-- Syncfusion ASP.NET Core Script Manager -->
67-
<ejs-scripts add-nonce="@Context.Items["ScriptNonce"]"></ejs-scripts>
69+
<ejs-scripts add-nonce="@Context.Items["Nonce"]"></ejs-scripts>
6870
</body>
6971
{% endhighlight %}
7072
{% endtabs %}

0 commit comments

Comments
 (0)