Compartilhar via


FormDigest Class

The FormDigest class inserts a security validation within the form of an .aspx page.

System.Object

   System.Web.UI.Control

      Microsoft.SharePoint.WebControls.SPControl

         Microsoft.SharePoint.WebControls.FormDigest

Public Constructors

The following table shows the public constructors of the FormDigest class and a brief description of each.

Name Description
FormDigest Initializes a new instance of the FormDigest class.

Protected Methods

The following table shows the protected methods of the FormDigest class and a brief description of each.

Name Description
Render Sends the content of the control to the specified HtmlTextWriter object, which writes the content that is rendered on the client.

Public Properties

The following table shows the public properties of the OWSNumberField class, the data type of each property, and a brief description of each.

Name Data Type Description
DigestValue String Gets the value of the security validation that is inserted in the .aspx page.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

To make posts from a Web application that modify the contents of the database, you must include the FormDigest control in the form making the post. The FormDigest control generates a security validation, or message digest, to help prevent the type of attack whereby a user is tricked into posting data to the server without knowing it. The security validation is specific to a user, site, and time period and expires after a configurable amount of time. When the user requests a page, the server returns the page with security validation inserted. When the user then submits the form, the server verifies that the security validation has not changed.

For more information on security validation, see Security Validation and Making Posts to Update Data.

Example

The following code example shows a form that contains the FormDigest control.

<form id="Form1" method="post" >
   <SharePoint:FormDigest />
   <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 282px; POSITION: absolute;
      TOP: 282px"  Text="Button"></asp:Button>
</form>

Requirements

Namespace: Microsoft.SharePoint.WebControls

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security