Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

XForm events in MVC project


I am working on an MVC site which has an XForm form on one of the pages. 

I added code in the global.asax.cs file like it is done here:

protected void Application_Start(Object sender, EventArgs e)

   // some code here

    XFormControl.ControlSetup += new EventHandler(XForm_ControlSetup);
public void XForm_ControlSetup(object sender, EventArgs e)
    XFormControl control = (XFormControl)sender;

    control.BeforeLoadingForm += new LoadFormEventHandler(XForm_BeforeLoadingForm);
    control.ControlsCreated += new EventHandler(XForm_ControlsCreated);
    control.BeforeSubmitPostedData += new SaveFormDataEventHandler(XForm_BeforeSubmitPostedData);
    control.AfterSubmitPostedData += new SaveFormDataEventHandler(XForm_AfterSubmitPostedData);
public void XForm_ControlsCreated(object sender, EventArgs e)
	XFormControl formControl = (XFormControl)sender;
    // the rest of the code here

and the other event handlers below ....

The view:

@model PageViewModel


@Html.PropertyFor(m => m.CurrentPage.Form)


[ContentType(DisplayName = "Formulärsida", GUID = "066267cd-af44-47db-a7e3-6aec27543d6c", Description = "")]
public class FormsPage : EditorialPage
        Name = "Formuläret",
        Description = "Formuläret",
        GroupName = SystemTabNames.Content,
        Order = 1)]
    public virtual XForm Form { get; set; }


public class FormsPageController : PageController
	public ActionResult Index(FormsPage currentPage)
		PageViewModel vm = new PageViewModel(currentPage);
		return View(vm);

I attach to the IIS process, and add breakpoints in all the XForm events in the global.asax.cs file, go to the page having the XForm form and assumed that the events would be triggered. They are not.

Any suggestions why?

Thanks for any kind of guidance!! 

Dec 09, 2014 11:57

Thank you for your reply.

I tried your solution but with the same result. :(

Dec 09, 2014 14:08
* 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.