我们使用auth2.0进行windows azure活动目录身份验证,其中在https://login.microsoftonline.com/login.srf?wa=wsignin1.0&wtrealm=上执行身份验证,并且在成功进行身份验证后,我们将重定向到我们的网站.要注销该网站,我们会删除在我们网站上生成的所有Cookie,并再次重定向到login.microsoftonline.com/login.srf?wa=wsignin1.0&wtrealm = .......网址,但此时我们还没有收到任何登录凭据屏幕,并使用访问令牌重定向到我们的站点.注销需要什么过程.因为如果我们删除所有cookie或关闭浏览器并重新打开网站工作并将我们重定向到login.microsoftonline.com/login.srf?wa=wsignin1.0&wtrealm = ........ url.
我们使用以下代码进行注销过程
[NoCacheAttribute]
public ActionResult LogOut()
{
UserCookieWrapper.delete_UserCookieWrapper();
//This function delete all the datamemeber of the UserCookieWrapper class
string[] theCookies =
System.IO.Directory.GetFiles(Environment.GetFolderPath(
Environment.SpecialFolder.Cookies));
foreach(string currentFile in theCookies)
{
try
{
System.IO.File.Delete(currentFile);
}
catch(Exception objEx) { }
}
Response.Clear();
return RedirectToAction("Index", "Login");
}
Run Code Online (Sandbox Code Playgroud)