ASP.NET WebForms has UI logic is closely related to the code and is difficult to separate from it, therefore scripts and styles are embedded in the generated HTML code uncontrollably.
When using the WebForms, you can use '<hash-algorithm>-<base64-value>', but the hash values will depend on the deployment environment.
For WebForms , ASP.NET itself inserts some inline scripts. To add the nonce= attribute to them and use 'nonce-<base64-value>', you need to override the built-in methods, for example CreateHtmlTextWriter
I think this document is helpful to you: CSP in ASP.NET WebForms and ASP.NET MVC
Best Regards
Qi You
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.