Back to Devexpress

WidgetFactory<TModel>.AddCspNonce(String) Method

aspnetcore-devextreme-dot-aspnet-dot-mvc-dot-factories-dot-widgetfactory-1-dot-addcspnonce-x28-system-dot-string-x29.md

latest1.3 KB
Original Source

WidgetFactory<TModel>.AddCspNonce(String) Method

A nonce value allowed in your Content Security Policy (CSP) script-src configuration.

Namespace : DevExtreme.AspNet.Mvc.Factories

Assembly : DevExtreme.AspNet.Core.dll

Declaration

csharp
public HtmlString AddCspNonce(
    string value
)

Parameters

NameTypeDescription
valueString

A string that specifies the nonce value.

|

Returns

Type
HtmlString

Remarks

Call this method in each non-partial view before the first DevExtreme control is defined:

cshtml
<meta http-equiv="Content-Security-Policy"
    content="default-src 'self';
    script-src 'self' 'nonce-allowed-value';"
/>

@Html.DevExtreme().AddCspNonce("allowed-value")
@(Html.DevExtreme().Button()
    .Text("Submit")
)

See Also

WidgetFactory<TModel> Class

WidgetFactory<TModel> Members

DevExtreme.AspNet.Mvc.Factories Namespace