登录:
[HttpPost]
        public ActionResult LoginSuccess()
{

bool rememberMe = Request["rememberMe"].Contains("true");
UserAccount account = ia.GetUserAccountByUserName(brief.UserName);

//验证成功
                    string usercookie = account.UIN + "," + brief.UserName;
                    FormsAuthentication.SetAuthCookie(usercookie, rememberMe);

}

 

注销:

        public ActionResult LoginOut()
        {
            FormsAuthentication.SignOut();
}

 

判断是否登陆:

 [AuthorizeAttribute]
        public ActionResult Payment(int? lid,long? classid)
        {}

 

webcofig:

  <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
      
    </authentication>

 

没有登录时候

ie地址栏:

http://localhost/Account/Login?ReturnUrl=%2fShoppingCart%2fpayment%3flid%3d1%26classid%3d10010%26type%3dbuy&lid=1&classid=10010&type=buy

 

 

 

 

 

相关文章:

  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2021-07-04
  • 2022-12-23
猜你喜欢
  • 2021-08-21
  • 2021-07-14
  • 2022-12-23
  • 2022-02-04
  • 2022-01-05
  • 2022-12-23
  • 2021-06-08
相关资源
相似解决方案