Esempio n. 1
0
        /// <summary>
        /// 根据用户名重定向功能页面
        /// </summary>
        /// <param name="userName"></param>
        private void Redirect(string userName)
        {
            //检查是否存在用户名
            if (string.IsNullOrWhiteSpace(userName))
            {
                Response.Write("没有对应的用户");
                return;
            }

            //创建用户配置文件
            ProfileManger currentUserProfile = new ProfileManger(userName);

            currentUserProfile.SetUserProfile();
            //创建授权证书
            System.Web.Security.FormsAuthentication.SetAuthCookie(userName, true);

            //由其他页面跳转过来
            if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
            {
                FormsAuthentication.RedirectFromLoginPage(userName, true);
                return;
            }



            //根据用户级别,跳转页面
            if (currentUserProfile.UserLevel == USCTAMis.Common.UserInfo.StudentLevel)
            {
                USCTAMis.IBLL.Common.ICommonOperate  _commonOperateBLL = new USCTAMis.BLL.Common.CommonOperate();
                USCTAMis.Web.WebClient.ProfileManger _profileManger    = new Web.WebClient.ProfileManger(HttpContext.Current.User.Identity.Name);
                //在这里处理学生欠费的操作
                string message = string.Empty;
                if (_commonOperateBLL.IsLackMoney(_profileManger.UserAccountID, ref message))
                {
                    FormsAuthentication.SignOut();
                    Response.Redirect("~/LackMoney/LackMoney.htm");
                }
                else
                {
                    Response.Redirect("StudentMain.aspx");
                }
            }
            else
            {
                Response.Redirect("Main.aspx");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 根据用户名重定向功能页面
        /// </summary>
        /// <param name="userName"></param>
        private void Redirect(string userName)
        {
            //检查是否存在用户名
            if (string.IsNullOrWhiteSpace(userName))
            {
                Response.Write("没有对应的用户");
                return;
            }

            //创建用户配置文件
            ProfileManger currentUserProfile = new ProfileManger(userName);
            currentUserProfile.SetUserProfile();
            //创建授权证书
            System.Web.Security.FormsAuthentication.SetAuthCookie(userName, true);

            //由其他页面跳转过来
            if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
            {
                FormsAuthentication.RedirectFromLoginPage(userName, true);
                return;
            }

            //根据用户级别,跳转页面
            if (currentUserProfile.UserLevel == USCTAMis.Common.UserInfo.StudentLevel)
            {
                USCTAMis.IBLL.Common.ICommonOperate _commonOperateBLL = new USCTAMis.BLL.Common.CommonOperate();
                USCTAMis.Web.WebClient.ProfileManger _profileManger = new Web.WebClient.ProfileManger(HttpContext.Current.User.Identity.Name);
                //在这里处理学生欠费的操作
                string message = string.Empty;
                if (_commonOperateBLL.IsLackMoney(_profileManger.UserAccountID, ref message))
                {
                    FormsAuthentication.SignOut();
                    Response.Redirect("~/LackMoney/LackMoney.htm");
                }
                else
                {
                    Response.Redirect("StudentMain.aspx");
                }
            }
            else
            {
                Response.Redirect("Main.aspx");
            }
        }