Skip to content

Turning a GET into a POST for SPWorkflowManager.StartWorkflow()

I mentioned in a previous post that you must run StartWorkflow on a POST request and not a GET request but I didn’t have time then to figure out how to do this quickly in a web part…  Here’s how to do it…  In any WebControl (or anything that can be to the Page object) add the following line.

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), “post”, “<SCRIPT Language=\”JavaScript\”>\n<!–\ndocument.forms[0].submit();\n–>\n</SCRIPT> “, false);

This will cause the page to post back to itself once it’s loaded.  It’s a kluge, but it solves the issue


Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: