html5中文学习网

您的位置: 首页 > 网络编程 > ASP.NET » 正文

ASP.NET Passport SingOut 方法_.NET教程_编程技术

[ ] 已经帮助:人解决问题
asp.net
public static void SignOut(string strSignOutDotGifFileName)
    {
      HttpContext httpContext = HttpContext.Current;
      string[] strs6 = new string[]{"MSPAuth", "MSPProf", "MSPConsent", "MSPSecAuth", "MSPProfC"};
      string[] strs1 = strs6;
      strs6 = new string[]{"TicketDomain", "TicketDomain", "ProfileDomain", "SecureDomain", "TicketDomain"};
      string[] strs2 = strs6;
      strs6 = new string[]{"TicketPath", "TicketPath", "ProfilePath", "SecurePath", "TicketPath"};
      string[] strs3 = strs6;
      string[] strs4 = new string[5];
      string[] strs5 = new string[5];
      PassportIdentity passportIdentity = null;
      int i = 0;
      httpContext.Response.ClearHeaders();
      try
      {
        if (httpContext.User.Identity is PassportIdentity)
        {
          passportIdentity = (PassportIdentity)httpContext.User.Identity;
        }
        else
        {
          passportIdentity = new PassportIdentity();
        }
        if (passportIdentity != null && _iPassportVer >= 3)
        {
          for (i = 0; i < 5; i++)
          {
            object local1 = passportIdentity.GetCurrentConfig(strs2[i]);
            if (local1 != null && local1 is String)
            {
              strs4[i] = (String)local1;
            }
          }
          for (i = 0; i < 5; i++)
          {
            object local2 = passportIdentity.GetCurrentConfig(strs3[i]);
            if (local2 != null && local2 is String)
            {
              strs5[i] = (String)local2;
            }
          }
        }
      }
      catch (Exception)
      {
      }
      for (i = 0; i < 5; i++)
      {
        HttpCookie httpCookie = new HttpCookie(strs1[i], "");
        httpCookie.Expires = new DateTime(1998, 1, 1);
        if (strs4[i] != null && strs4[i].Length > 0)
        {
          httpCookie.Domain = strs4[i];
        }
        if (strs5[i] != null && strs5[i].Length > 0)
        {
          httpCookie.Path = strs5[i];
        }
        else
        {
          httpCookie.Path = "/";
        }
        httpContext.Response.Cookies.Add(httpCookie);
      }
      httpContext.Response.Expires = -1;
      httpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
      httpContext.Response.AppendHeader("Pragma", "no-cache");
      httpContext.Response.ContentType = "image/gif";
      httpContext.Response.WriteFile(strSignOutDotGifFileName);
      string str = httpContext.Request.QueryString["ru"];
      if (str != null && str.Length > 1)
      {
        httpContext.Response.Redirect(str, false);
      }
    }
MkXHTML5中文学习网 - HTML5先行者学习网
MkXHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助