Delay Web Request using HttpRuntime.ProcessRequest

Discussion in 'ASP .Net' started by Ross Dempster, Jul 18, 2003.

  1. Hi everyone, this is quite involved but if anyone can help (or just
    likes a challenge!) i would very much appreciate it.

    Quick intro :
    I have forms based authentication (though i do it manually - not with
    the built in gizmo). The session times out after 30 minutes.

    The problem :
    User may take longer than 30 minutes to fill out the form. They would
    need to log back in on submission - but if I redirect then they loose
    what they typed.

    What I want to do :
    When i detect a login has expired ...
    1) store request
    2) send to login page
    3) on successful login: re-run the original request

    nb. i cannot simply process the request as normal and store control
    values before redirecting because some of my form (drop-down lists
    etc) has content which is derived from the logged-in user. i have to
    get a successful login before i process the page. i also cannot use
    non-forms authentication because IIS interferes with it and my host
    will unlikely modify their configuration.

    Possible solution :
    Imagine I have code in place to package up the request (inc headers
    etc). This data will be passed via the login page (through a
    server-side transfer) to the user's browser (in a hidden field). When
    the user submits the log-in, the original request data comes back in
    the hidden field ... this part i think i can do.

    On to the hard part :
    My code needs to use HttpRuntime.ProcessRequest to process this
    original request and send the response back to the browser. I can use
    the response stream from the current login submission to pass data
    back, but i cannot get the ProcessRequest function to work!

    I am trying this currently without any of the supporting framework i
    described above. That is to say: I have a single .aspx form which
    attempts to ProcessRequest another page (using the Response.Output
    stream to send back output).

    Where it all goes wrong:

    approach 1 - using SimpleWorkerRequest: this breaks either with a
    "null reference" exception or "unable to override application path"
    depending on what constructor you use. The exception is in the runtime
    so i don't think it is my fault. If I start the request in another
    application domain then it works but i cannot easily get the response
    stream back to my original domain. Also, I do not want the performance
    hit of running multiple domains - esp. when the domain I am executing
    in is an HttpRuntime capable domain in the first place!

    approach 2 - deriving HttpWorkerRequest: where to start? there is no
    guide that tells you the bare minimum of functions you need to
    implement - and there are too many to implement them all. I tried
    sticking debug output in them all to see which ones are actually
    called and implementing just those. Now the problem is that the
    documentation on them is so thin that it is difficult to know exactly
    what you are trying to implement (eg. "GetUriPath: Returns the virtual
    path to the requested URI." - now does that include host, page name ?)
    Anyway, I've implemented these as best i can and now the runtime
    causes a stack overflow. It repeatedly calls GetAppPathTranslated,
    more than 20 thousand times in fact. I would hazard a guess that my
    GetAppPathTranslated is broken but I have tried as many combinations
    of returing this path as i can think of! eg. with page-name, without
    page-name, fully-qualified, relative etc.

    Anyway, I'm all out of ideas. I know its a long shot but if anyone
    knows much about this stuff I would really appreciate the help.

    Ross Dempster, Jul 18, 2003
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rajesh Patel
    Rajesh Patel
    Jan 18, 2005
  2. Chance Hopkins

    IHttpHandler, ProcessRequest and Session

    Chance Hopkins, Apr 14, 2005, in forum: ASP .Net
    Chance Hopkins
    Apr 14, 2005
  3. Philipp Schumann


    Philipp Schumann, Jun 3, 2005, in forum: ASP .Net
    Philipp Schumann
    Jun 4, 2005
  4. Replies:
  5. Guest
    Steven Cheng[MSFT]
    Feb 21, 2007
  6. Mathieu Cartoixa
    Mathieu Cartoixa
    Nov 22, 2007
  7. Scott Roberts
    Alexey Smirnov
    Jan 6, 2010
  8. David Elliott
    David Elliott
    Jan 27, 2005