[CSP Manager] Use nonce programmatically

Hi,

I’m using CSP Manager in Umbraco v13. It works great.
I am using nonce as described in the documentation, and it works very nicely.
But we have one script that uses a nonce that is created in the ViewComponent. Before we used ASP Nonce.

Is it also possible with the CSP Manager Nonce to call it from C# programmatically?

Hi,

Yes should be able to inject ICspService and call GetCspScriptNonce or GetCspStyleNonce depending on which one you need

Matt

Yeah, I found it.

I had installed the plugin via dotnet CLI, but apparently it wasn’t added as a dependency correctly. So I did it again via NugetPackageManager in VS and now it is working.

Thanks for the great package and fast response @MattW

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.