Hi I have a SharePoint list. My client wanted me to redirect the form to site intranet after submitting the form.

  • 1
    Please provide use with some more details. What form - InfoPath, WebForm? Is it foundation or enterprise? What version of SharePoint - 2007, 2010, 2013? etc.
    – user2536
    Commented Mar 4, 2014 at 13:54

3 Answers 3


In case of using Infopath form you can host your browser-enabled InfoPath form on your own XmlFormView webpart and then notify host to redirect. Add the following code to the Button control’s Clicked event handler:


Create VisualWebPart project and add XmlFormView control to VisualWebPart, you must add


The following code shows how to do this:

<cc1:XmlFormView ID="XmlFormView1" runat="server" XsnLocation="http://ServerName/FormServerTemplates/MyFormTemplate.xsn" OnNotifyHost="XmlFormView1_NotifyHost" />

After you hook up the event, you must implement the XmlFormView1_NotifyHost event handler in the code-behind of the VisualWebPart as follows:

protected void XmlFormView1_NotifyHost(object sender, NotifyHostEventArgs e)
if (e.Notification == "Redirect")
    string jsCode = "window.location='http://www.google.com';";
    Page.ClientScript.RegisterStartupScript(typeof(string), "RedirectScript", jsCode, true);

You need use a function window.location of the JavaScript in the function PreSaveAction.


You can use the "source" attribute in query string and provide external url there. Just remember that whether you click on submit or cancel, the form will be redirected. Check this for more details: http://sympmarc.com/2009/10/20/passing-a-source-parameter-on-the-query-string-with-multiple-other-parameters/comment-page-2/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.