November Happy Hour will be moved to Thursday December 5th.

XForms and "Page shown after the form has been sent" not working

Vote:
 

I have created a XForm page, where I've selected a page to be shown after the form has been submitted.When running the site on my own computer this works as expected (data is saved, mail is sent and redirection happens). However in production, only saving the data and sending the email is done, no redirection.

 

Anybody got an idea about how I can solve this? 

#54691
Oct 28, 2011 13:33
Vote:
 

Usually has something to do with the SMTP-server. Since sending is done it might not respond in the way EPiServer requires.

#54695
Oct 28, 2011 15:25
Vote:
 

Johan is correct, AfterSubmitPostedData will not trigger if the SMTP fails at sending the mail. Do you get the redirect if you only save the data to the database, removing the mailing from the equation?

Here is a page with further ideas on what might be wrong: http://baisaksen.net/episerver/xform-not-redirecting-after-submit

#54707
Oct 29, 2011 16:16
Vote:
 

It fails to redirect even when it's set to only save the data to the database. When set to save to database and send mail it does both, but still not redirecting. 

I have also tried and checked everything mentioned on that blog. Guess I'll have to debug further.

 

#54723
Oct 31, 2011 11:30
Vote:
 

Hm, I recall having to do the redirect manually once, can't remember why though. Added something like

xForm.AfterSubmitPostedData += xForm_AfterSubmitPostedData; //where xForm was the XFormControl

in the OnInit event on my UC, and

private void xForm_AfterSubmitPostedData(object sender, SaveFormDataEventArgs e)
{
     var xFormControl = (XFormControl)sender;

     if (xFormControl.FormDefinition.PageGuidAfterPost == Guid.Empty)
     {
         return;
     }
     var pageMap = PermanentLinkMapStore.Find(xFormControl.FormDefinition.PageGuidAfterPost) as PermanentPageLinkMap;
     if (pageMap == null)
     {
          return;
     }
     xFormControl.Page.Response.Redirect(pageMap.MappedUrl.ToString());
}

Not so pretty, I know, but it was only for one of my own playground projects.

#54726
Oct 31, 2011 12:45
Vote:
 

Could the issue be related to IIS? The site is hosted on a server running IIS 6 (and thus classic mode instead of integrated mode).

#55290
Nov 25, 2011 15:55
Vote:
 

How does your global.asax.cs look? The redirection code should be there. The test form you´re using is it the same on both your local and remote server? Make sure under MailSettings in web.config that you´ve set the from email address to a valid email address, same in the form.

Frederik

#55295
Nov 26, 2011 13:20
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.