Note that there are some explanatory texts on larger screens.

plurals
  1. POReuse postback data in HttpModule
    primarykey
    data
    text
    <p>I have a custom HttpModule, which handles if a user need to pay a invoice. If the user has made a postback, but is "caught" in the invoice section of my HttpModule, I would like to repost the original postback, that the user made, after the invoice has been paid, so the user does not have to start over.</p> <p>Example:</p> <ol> <li>The user fill out a form and submit it to the server</li> <li>The HttpModule identifies that the user has an unpaid invoice, and redirects the user to the payment page</li> <li>The user pays the bill</li> <li>The original post from point 1 is reposted and the user can continue </li> </ol> <p>I've tried saving the HttpContext (from HttpContext.Current) in the session state and setting HttpContext.Current to the value in the session, when the bill has been paid, but it does not work. </p> <p>Is it possible to reuse a postback after the HttpModule has interrupted the normal flow?</p> <p>My HttpModule looks like this: class UnpaidInvoiceHttpModule : IHttpModule { private HttpApplication cHttpApp;</p> <pre><code> public void Dispose(){} public void Init(HttpApplication context) { cHttpApp = context; context.PreRequestHandlerExecute += new EventHandler(CheckForUnpaidInvoices); } private void CheckForUnpaidInvoices(Object s, EventArgs e) { if (HttpContext.Current.Request.Path.EndsWith(".aspx") || HttpContext.Current.Request.Path.EndsWith(".asp") || HttpContext.Current.Request.Path == "/") { if (HttpContext.Current.Request.Path != "/login.aspx" &amp;&amp; HttpContext.Current.Request.Path != "/Payment/Default.aspx" &amp;&amp; HttpContext.Current.Request.Path != "/Payment/Default_notice.aspx" &amp;&amp; HttpContext.Current.User != null) { if (HttpContext.Current.User.Identity.IsAuthenticated) { CustomUser mUser = ManagerSecurity.SecurityAPI.GetUser(); if (mUser.HasUnpaidInvoices) { HttpContext.Current.Session["prepaymentHttpContext"] = HttpContext.Current; HttpContext.Current.Response.Redirect("/Payment/Default.aspx"); } else { if (HttpContext.Current.Session["prepaymentHttpContext"] != null) { HttpContext.Current = (HttpContext)HttpContext.Current.Session["prepaymentHttpContext"]; } } } } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload