Skip to content

FormDigest Extender

August 31, 2006

The post was reposted from:

Recently, I have been working on a SharePoint-based web app that uses some Ajax to reduce the number of postbacks. Because it might be a long time before the user triggers another postback the page’s security validation can potentially timeout; giving the user a frightening error page.

As one possible solution, I whipped together a little web part (really the Content Editor + some Javascript) to obtain a new form digest value and shim it into the current page.

While this works fairly well there is room for improvement.

First, it makes a request to the current page which can cause problems or at the very least it’s a waste of bandwidth. A possible fix for this would be to create a very small stub page to call instead for updating the security validation.

Second, you must remember the purpose of the security validation. It’s for security! You shouldn’t be infinitely extending the security validation of the page without good reason. So it is best to only extend it based on some user action.

The example is contained in teh attached dwp (remove the .txt from the filename).

Warning: Use the FormDigest Extender at your own risk.

Leave a Comment

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: