private void Page_Load(object sender, System.EventArgs e)
        {
            ValidationManager mgr = new ValidationManager();

            if (mgr.ValidateUserInfo(Request.Headers))
            {
                ReportServerProxy server = new ReportServerProxy();

                string reportServer = ConfigurationManager.AppSettings["ReportServer"];
                string instanceName = ConfigurationManager.AppSettings["ReportServerInstance"];

                // Get the server URL from the report server using WMI
                server.Url = ValidationManager.GetReportServerUrl(reportServer, instanceName);

                server.LogonUser(mgr.ValidatedUserToken, Request.Headers["AuthToken"], null);
                string redirectUrl = Request.QueryString["ReturnUrl"];
                if (redirectUrl != null)
                {
                    HttpContext.Current.Response.Redirect(redirectUrl, false);
                }
                else
                {
                    HttpContext.Current.Response.Redirect("./Folder.aspx", false);
                }
            }
        }
        /// <summary>
        /// Indicates whether a supplied username and password are valid.
        /// </summary>
        /// <param name="userName">The supplied username</param>
        /// <param name="password">The supplied password</param>
        /// <param name="authority">Optional. The specific authority to use to
        /// authenticate a user. For example, in Windows it would be a Windows
        /// Domain</param>
        /// <returns>true when the username and password are valid</returns>
        public bool LogonUser(string userName, string password, string authority)
        {
            ValidationManager mgr = new ValidationManager();

            return(mgr.ValidateUserInfo(HttpContext.Current.Request.Headers));
        }