Skip to content

Commit cd762ad

Browse files
Merge pull request #4642 from syncfusion-content/991761-Replace-obsoleteHF
991761: Replace obsolete Class used in CSP
2 parents 1d40767 + 464c6d1 commit cd762ad

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

ej2-asp-core-mvc/EJ2_ASP.NETCORE/system-requirements.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@ To get started with ASP.NET Core application, ensure the following software to b
1616

1717
ASP.NET Core Applications can be developed using one of the following IDEs. You can also develop using [.NET CLI](https://docs.microsoft.com/en-us/dotnet/core/tools/) without below IDEs.
1818

19-
* [Visual Studio 2022](https://visualstudio.microsoft.com/vs/)
19+
* [Visual Studio 2026](https://visualstudio.microsoft.com/downloads/#visual-studio-professional-2026)
20+
* [Visual Studio 2022](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2022-and-other-products)
2021
* [Visual Studio 2019](https://visualstudio.microsoft.com/vs/older-downloads/)
2122
* [Visual Studio Code](https://code.visualstudio.com/)
2223

2324
## Framework & SDK
2425

2526
One of the the following .NET SDK is required to develop and run the Syncfusion<sup style="font-size:70%">&reg;</sup> UI controls for ASP.NET Core application.
2627

28+
* [.NET 10.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/10.0)
2729
* [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)
2830
* [.NET 8.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
2931
* [.NET Core SDK 3.1](https://dotnet.microsoft.com/en-us/download/dotnet/3.1)
3032
* [.NET Core SDK 2.0](https://dotnet.microsoft.com/en-us/download/dotnet/2.0)
3133

3234
If you are planning to use Visual Studio to develop ASP.NET Core Applications.
35+
* .NET 10.0 requires Visual Studio 2026 18.0.0 or later.
3336
* .NET 9.0 requires Visual Studio 2022 17.12.0 or later.
3437
* .NET 8.0 requires Visual Studio 2022 17.8.0 or later.
3538
* .NET Core SDK 3.1 requires Visual Studio 2019 16.4 or later.
36-
* .NET Core SDK 2.0 requires Visual Studio 2017 15.7 or later.
39+
* .NET Core SDK 2.0 requires Visual Studio 2017 15.7 or later.

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publishingplatform: ##Platform_Name##
88
documentation: ug
99
---
1010

11-
# Content Security Policy
11+
# Content Security Policy in ASP.NET Core
1212

1313
Content Security Policy (CSP) is a security feature implemented by web browsers to protect against attacks such as cross-site scripting (XSS) and data injection. It limits the sources from which content can be loaded on a web page. To enable strict Content Security Policy (CSP), certain browser features are disabled by default. To use Syncfusion<sup style="font-size:70%">&reg;</sup> controls with strict CSP mode, it is essential to include the following directives:
1414

@@ -29,14 +29,13 @@ using System.Security.Cryptography;
2929
...
3030
app.Use(async (context, next) =>
3131
{
32-
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
3332
byte[] nonceBytes = new byte[32];
34-
rng.GetBytes(nonceBytes);
33+
RandomNumberGenerator.Fill(nonceBytes);
3534
string nonceValue = Convert.ToBase64String(nonceBytes);
36-
context.Items.Add("ScriptNonce", nonceValue);
35+
context.Items.Add("Nonce", nonceValue);
3736
context.Response.Headers.Add("Content-Security-Policy", string.Format(
3837
"script-src 'self' 'nonce-{0}' https://cdn.syncfusion.com;" +
39-
"style-src-elem 'self' 'unsafe-inline' https://cdn.syncfusion.com https://fonts.googleapis.com;" +
38+
"style-src-elem 'self' 'nonce-{0}' https://cdn.syncfusion.com https://fonts.googleapis.com;" +
4039
"font-src 'self' data: https://fonts.gstatic.com;" +
4140
"object-src 'none';", nonceValue));
4241
await next();
@@ -52,8 +51,10 @@ app.Use(async (context, next) =>
5251
{% highlight c# tabtitle="~/_Layout.cshtml" %}
5352
<head>
5453
...
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" />
5556
<!-- Syncfusion ASP.NET Core controls scripts -->
56-
<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>
5758
</head>
5859
{% endhighlight %}
5960
{% endtabs %}
@@ -65,7 +66,7 @@ app.Use(async (context, next) =>
6566
<body>
6667
...
6768
<!-- Syncfusion ASP.NET Core Script Manager -->
68-
<ejs-scripts add-nonce="@Context.Items["ScriptNonce"]"></ejs-scripts>
69+
<ejs-scripts add-nonce="@Context.Items["Nonce"]"></ejs-scripts>
6970
</body>
7071
{% endhighlight %}
7172
{% endtabs %}

0 commit comments

Comments
 (0)