Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

C#
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