Object reference error when using the HttpContext object

I have a test server script below….

 

public static void test()
    {
          int iCount = HttpContext.Current.Session.Count;
    }

On the form load event, it called that script and got the error below.

 

Failed to execute deployed method 'FormLoaded', using entity 'frmServer'. Object reference not set to an instance of an object.

 

Does anyone get this object reference error when using the HttpContext object? Any suggestion?

 

 

Tagged:

Comments

  • I'm not sure that HttpContext makes sense in the context of a BPM server side script. Imagine that the web client is on a different server than the engine. The engine would be running the server side script but have no knowledge of anything web server side.

  • So, I cannot use HTTPContext to get the host name. Any suggestion how to get the host name in MBPM?