帮我解释一下下面几行代码
if (FormsAuthentication.GetRedirectUrl(userId, false).EndsWith(URL_DEFAULT)) 
{
  FormsAuthentication.SetAuthCookie(userId, false);
  HttpContext.Current.Response.Redirect(URL_ACCOUNTSIGNIN, true);
}
else
{
  // Take the customer back to where the came from
   FormsAuthentication.SetAuthCookie(userId, false);
   HttpContext.Current.Response.Redirect(FormsAuthentication.GetRedirectUrl(userId, false), true);
}

解决方案 »

  1.   

    就是FORM验证时候,你判断你的URL的USERID是不是以URL——DEFAULT结尾,是的话,就写COOKIE跳转页面
    不是的话跳到登陆页面
      

  2.   

    Response.Redirect()你知道的吧,只不过里面的页面地址不一样FormsAuthentication.SetAuthCookie(userId, false);
    也就是FORM验证写一下COOKIE,因为FORM验证时,它先判断是不是匿名用户登陆,也就是到COOKIE里找有没有注册过这个用户FormsAuthentication.GetRedirectUrl(userId, false).EndsWith(URL_DEFAULT)) 
    是取返回的URL,和用户
      

  3.   

    FormsAuthentication.GetRedirectUrl 是得到请求页面的URL如果请求页面是URL_DEFAULT,则转到指定页面,否则转到相应的请求页