Usually has something to do with the SMTP-server. Since sending is done it might not respond in the way EPiServer requires.
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
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.
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.
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).
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
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?