Area: Episerver Add-ons
Applies to versions: 2 and higher

Redirecting visitors to a Thank you page

Recommended reading 

Note: Episerver Forms is only supported by MVC-based websites and HTML5-compliant browsers.

After a visitor submits a form, you can redirect them to a Thank you page using the Display page after submission field. You can have several forms go to the same Thank you page, so the following elements (in the redirect URL) let you know which form the visitor submitted using the DefaultAppendExtraInfoToRedirection class.

  • FormGuid. Unique ID of the FormContainerBlock. Use this ID to lookup the form instance.
  • FormLanguage. Language of the container page (where FormContainerBlock is dropped).
  • FormSubmissionId. Unique ID of the submission. Use this ID to lookup the recent submission (which drives a visitor to the Thank you page).

Forms.Core provides the IAppendExtraInfoToRedirection interface, and lets you customize the Thank you page. Basically, you should:

  1. Implement the interface.
  2. Make an InitializationModule, and use Dependency Injection to replace the default implementation.

A third-party developer can alter this behavior by implementing IAppendExtraInfoToRedirection, and using StructureMap in InitializationModule (DemoInitializationModule.cs) to replace the default implementation:

public void Initialize(InitializationEngine context) 
    _serviceConfigurationContext.Container.Configure(c => 
       c.For<IAppendExtraInfoToRedirection>().Use(new AppendInfoToRedirection());

See also the source code in Demo project on Episerver GitHub, especially the following code samples:

Do you find this information helpful? Please log in to provide feedback.

Last updated: Nov 02, 2016

Recommended reading