private void redeemReservation(ReservationInfo res)
        {
            long duration = (res.endTime.Ticks - res.startTime.Ticks) / TimeSpan.TicksPerSecond;
            TicketLoadFactory factory = TicketLoadFactory.Instance();
            ProcessAgentDB ticketing = new ProcessAgentDB();

            string payload = factory.createAllowExperimentExecutionPayload(
                res.startTime, duration, Session["groupName"].ToString(),clientGuid);
            DateTime tmpTime = res.startTime.AddTicks(duration * TimeSpan.TicksPerSecond);
            DateTime utcNow = DateTime.UtcNow;
            long ticketDuration = (tmpTime.Ticks - utcNow.Ticks) / TimeSpan.TicksPerSecond;

            TicketIssuerProxy ticketIssuer = new TicketIssuerProxy();

            //get the SB web service URL, and set the proxy's URL accordingly
            ProcessAgentInfo sbInfo = ticketing.GetServiceBrokerInfo();
            ticketIssuer.Url = sbInfo.webServiceUrl;

            //Get the agent coupon Coupon, to be embedded in the SOAP header of the web service call to the SB
            Coupon agentOutCoupon = sbInfo.identOut;

            iLabs.DataTypes.SoapHeaderTypes.AgentAuthHeader agentAuthHeader = new iLabs.DataTypes.SoapHeaderTypes.AgentAuthHeader();

            //set the SOAP header (of the proxy class) to the agentCoupon
            agentAuthHeader.coupon = agentOutCoupon;
            agentAuthHeader.agentGuid = ProcessAgentDB.ServiceGuid;
            ticketIssuer.AgentAuthHeaderValue = agentAuthHeader;

            //call the CreateTicket web service method on the SB (ticket issuer)
            Coupon allowExecutionCoupon = ticketIssuer.CreateTicket(TicketTypes.ALLOW_EXPERIMENT_EXECUTION,
                sbInfo.agentGuid, ticketDuration, payload);

            if (allowExecutionCoupon != null)
            {
                string couponId = allowExecutionCoupon.couponId.ToString();
                string passkey = allowExecutionCoupon.passkey;
                string issuerGuid = allowExecutionCoupon.issuerGuid;

                string backToSbUrl = Session["sbUrl"].ToString() +
                    "?coupon_id=" + couponId +
                    "&passkey=" + passkey +
                    "&issuer_guid=" + issuerGuid;

                Response.Redirect(backToSbUrl, false);
            }
            else
            {
                string msg = "Exception: ExperimentExecution is not allowed.";
                lblErrorMessage.Text = Utilities.FormatErrorMessage(msg);
                lblErrorMessage.Visible = true;
            }
        }