asp.netpublic 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);
}
}
ASP.NET Passport SingOut 方法
80酷酷网 80kuku.com