다음을 통해 공유


SPWeb.ValidateFormDigest Method

Validates the form digest control that is used in the current request.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Function ValidateFormDigest As Boolean
'Usage
Dim instance As SPWeb
Dim returnValue As Boolean

returnValue = instance.ValidateFormDigest()
public bool ValidateFormDigest()

Return Value

Type: System.Boolean
true if the form digest control is valid, otherwise, false.

Remarks

The ValidateFormDigest method can be used to explicitly check the security validation that is used in an ASPX page. This method searches the .aspx page for the INPUT control that is named __REQUESTDIGEST and verifies that the message digest contained in the control is valid. This method can be used in code that runs on a second .aspx page to which the first .aspx page posts, or on the first page if a second page is not involved. This method assumes that a FormDigest control exists on the .aspx page that is making the post.

Either SPUtility.ValidateFormDigest() or SPWeb.ValidateFormDigest() should be called before a call of RunWithElevatedPrivileges, if the method passed to the RunWithElevatedPrivileges includes any write operations.

See Also

Reference

SPWeb Class

SPWeb Members

Microsoft.SharePoint Namespace