// ********
        // This is the active Login method for this application
        // ********
        public static CurrentSession login(string strSessionKey, HttpSessionState session, BFConfiguration configuration)
        {
            string XForwardedFor = configuration.currentUser.ipAddress;

            if (string.IsNullOrEmpty(XForwardedFor)) return null;

            PostSubmitter post = new PostSubmitter();
            //post.Url = ServiceCaller.serviceUrlRoot(configuration) + "bms/auth/trusted.xml?devicePlatform=SPWebPart&X-Forwarded-For=" + System.Web.HttpUtility.UrlEncode(XForwardedFor);
            post.Url = ServiceCaller.serviceUrlRoot() + "bms/auth/trusted.xml?devicePlatform=SPWebPart&X-Forwarded-For=" + XForwardedFor;

            post.PostItems.Add("token", configuration.currentUser.sid);

            post.PostItems.Add("X-Forwarded-For", XForwardedFor);

            post.PostItems.Add("User-Agent", configuration.currentUser.userAgent);

            post.strSessionKey = strSessionKey;
            string BFLoginResponse = CommonFunctions.unLTGT(ServiceCaller.makePOST(post));

            string BFSessionKey = "";
            BFSessionKey = xmlReader.getValueBySimpleQuery(BFLoginResponse, "sessionKey", "", false);


            string BFPasscode = "";
            BFPasscode = xmlReader.getValueBySimpleQuery(BFLoginResponse, "passcode", "", false);

            CurrentSession _currentSession = new CurrentSession();
            _currentSession.sessionKey = BFSessionKey;
            _currentSession.passCode = BFPasscode;

            // bug27992: SharePoint portal authentication issue 
            // Modified - 09/18/2012
            // Serialized Session Information
            //session[CommonVariables.c_CookieContainer] = post.cookieContainer;
            configuration.currentSession = _currentSession;
            configuration.cookieContainer = post.cookieContainer;

            return _currentSession;

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            
            
            var serverRoot = BFServiceConfiguration.ServiceRoot;

            BFConfiguration configuration = new BFConfiguration();
            CurrentUser user = new CurrentUser();
            user.ipAddress = "192.168.1.165"; //CommonFunctions.getIP(this.Request);
            //user.id = ;
            //user.sid = "S-1-5-21-981513146-3610399622-1152084407-1010";
            user.sid = "S-1-5-21-3062783291-1561283076-1759620232-3763";
            user.loginName = "ranwar";
            user.userAgent = this.Request.UserAgent;

            configuration.currentUser = user;

            CurrentSession session = new CurrentSession();
            session.sessionKey = "";
            configuration.currentSession = session;
            configuration.ItemLimit = 1000;

            Response.Write("<h1 style='bottom:5px'>BizFlow Web Service Tester</h1>");
            Response.Write(string.Format("<h2 style='bottom:10px'>Result: <Label ID='lbResult'>{0}</Label></h2>", serverRoot));

            try
            {
                CurrentSession result = ServiceCaller.login(session.sessionKey, this.Session, configuration);
                Response.Write(string.Format("<br/><h2 style='color:blue; bottom:100px;'>Session Information Success</h2>"));
            }
            catch (Exception ex)
            {
                Response.Write(string.Format("<br/><h2 style='color:red; bottom:100px;'>There was an error {0} and inner exception {1} </h2>", ex.Message, ex.InnerException));
                throw ex;
            }
            finally
            {
                Response.Write("<br/><h3 style='bottom:50px;'>Test Complete</h3>");

            }
                
                


            //ServiceCaller.login_117(configuration);
            //int retVal = ServiceCaller.initiateWorkitem(configuration, BFWorkFlowTypes.SpecialsApplication, "[U]0000000102", "http://www.microsoft.com");
            //ServiceCaller.getBizCoveData(this.Session, ref configuration);

            //configuration.currentProcessID = 304;

            //ServiceCaller.completeWorkitem(configuration, 299);
            //ServiceCaller.getMyCompletedWorkitems(this.Session, ref configuration);

            //string procDetails = ServiceCaller.getWorkitemDetails(configuration);


            // In order to get all completed processes from all users
            //  SELECT [procid],[name] FROM [workflow].[dbo].[PROCS] WHERE [State]='C'
            //  AND [procid] in (SELECT [ProcessId] from [DERTFundingDecisions].[dbo].[SpecialRequestWorkflow]) 


        }