Created
October 5, 2019 12:38
-
-
Save emrekizildas/d61def377de36b47414ce397c7fa48d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Html; | |
using Microsoft.AspNetCore.Mvc.Rendering; | |
namespace CSPExample.Helper | |
{ | |
public static class NonceHelper | |
{ | |
public static HtmlString Nonce(this IHtmlHelper helper) | |
{ | |
string nonceValue = helper.ViewContext.HttpContext.Items["ScriptNonce"].ToString(); | |
return new HtmlString(nonceValue); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment