Doing a form POST to an EPiServer page


Has anyone out there tried posting to an EPiServer page? I am working on an ecommerce site, based on EPiServer, which posts to another site for handling payments. The other site then posts back to our site, and we need to pull various info from the Request.Form variables.

However, because of something that EPiServer's URL rewriting modules does, by the time Page_Load fires, the form variables are gone and the verb has changed from POST to GET.

As a quick and dirty workaround we have overriden EPiServer's URL rewriting and rewritten the path ourselves, which works - almost. The only problem we have now is that the EPiServer properties do not work properly.

Does anyone have any suggestions as to how to fix this? Thanks.

Sep 10, 2008 16:44

We've improved the workaround so that it passes the page ID on the querry string. This has got the EPiServer property controls working again. The code is as follows

protected override void HttpUrlRewriteToInternal(EPiServer.UrlBuilder url)

if (requestUrl.Contains("CheckoutComplete"))

However this now means we have got a hard-wired page ID, any suggestions as to how we can avoid this?

Sep 15, 2008 10:53

Looks like you can programatically discover the ID of a page, using the URL builder, as follows

private PageReference GetPageReference(UrlBuilder url)
    object page;
    Global.UrlRewriteProvider.ConvertToInternal(url, out page);
    return page as PageReference;

The use the ID property of the PageReference class.

Sep 15, 2008 11:35

Looks like the last bit doesn't work. Calling ConvertToInternal in order to get the PageReference also ends up rewriting the URL. Doh!

Guess we will have to go back to hard-wiring the page id, unless anyone has any suggestions?

Sep 15, 2008 12:41