Problem using HttpCotnext in brwoser-enabled form - InfoPath Dev
in

InfoPath Dev

Problem using HttpCotnext in brwoser-enabled form

Last post 04-16-2007 12:48 AM by davidair. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-27-2007 06:53 AM

    Problem using HttpCotnext in brwoser-enabled form

    We have a set of forms deployed on MOSS and need to maintain user state across all forms. We tried using HttpContext.Current in form code. To set the session variable, we do this:

    if (Application.Environment.IsBrowser)
    {
    HttpContext.Current.Session["entity.ID"] = e.NewValue;
    }

    then on receiving forms, we do the following:

    if (application.Environment.IsBrowser)
    {
    object sessionObj = HttpContext.Current.Session["entity.ID"];
    string sessionValue;
    if (sessionObj != null)
    {
    sessionValue = sessionObj.ToString();
    }
    }


    The receiving forms work initially but after a few load of the form, the session variable is lost. That is, sessionObj != null evaluates to false.

    Any idea what is happening here?


  • 04-16-2007 12:48 AM In reply to

    Re: Problem using HttpCotnext in brwoser-enabled form

    Although what you are describing should work in principle (ASP.NET session persists across the farm) it remains that the ASP.NET session is a shared resource you do not necessarily control. Maybe the data size is what is causing the session failures. You should try to see if changing the size of your object changes the failure characteristics (what if you store a single-character value, will it also dissapear?)

    Also, when you say "a few loads", is it a number which varies all the time, or is it always the same, say, "three"

    Although I am not sure what your issue is exactly, one workaround I would suggest is to store your shared data in a data connection, such as webservice. This has a huge advantage of your form being able to run the same on both client and server without writing different code for each. After all, data connections are first-class citizens in InfoPath!

    Hope this makes sense,

    Dave.

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.