Skip to main content
All docs
V23.2

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

public HtmlString AddCspNonce(
    string value
)

Parameters

Name Type Description
value String

A string that specifies the nonce value.

Returns

Type
HtmlString

Remarks

Call this method in each root View before the first DevExtreme control is defined:

<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