Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

SharePoint Form Digest

Posted by Paul on May 23, 2015


In this article we can explore about Form Digest in SharePoint.

Form Digest

Form Digest is used to insert a security validation for SharePoint pages. The digest value will be created by SharePoint server during page creation.

Example: A user loads a SharePoint page. He injected a script which updates the list data. When the user posts the page, the server will check Form Digest value against the page content. Thus, security attacks can be prevented.

Viewing Form Digest

You can use the view-source of a SharePoint page to see the form digest value. The value is stored under name ___REQUESTDIGEST.

image

FormDigest Class

For custom pages, you need to us the FormDigest user control for automatically inserting the form digest value. Following is the definition of FormDigest class.

image

Following is the usage of FormDigest class.

image

Once the page is rendered, the view-source will show the __REQUESTDIGEST key-value pair.

image

Client Side

While working client-side scripts OR invoking REST services, we need the form digest value creation or refresh. Refresh is required especially for SPA (Single Page Applications) where the user won’t load the page for long time & use scrolling/update feature to interact with it. (Eg: Facebook App)

References

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.formdigest.aspx

Summary

In this post we have explored Form Digest in SharePoint.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s