我有一个用于Windows Azure认证的身份验证页面,其中在https://login.microsoftonline.com/login.srf?wa=wsignin1.0&wtrealm=上执行认证......成功认证后,我们将重定向到我们的网站。
我们需要删除在此URL上生成的cookie以进行注销。有人能否提供通过该代码删除外部站点cookie的方法。
我们尝试使用以下代码进行删除,但未能成功。
我们需要删除在此URL上生成的cookie以进行注销。有人能否提供通过该代码删除外部站点cookie的方法。
我们尝试使用以下代码进行删除,但未能成功。
public void deleteallcookies()
{
int limit = Request.Cookies.Count;
HttpCookie aCookie; //Instantiate a cookie placeholder
string cookieName;
//Loop through the cookies
for(int i = 0; i < limit; i++)
{
cookieName = Request.Cookies[i].Name; //get the name of the current cookie
aCookie = new HttpCookie(cookieName);
aCookie.Value = ""; //set a blank value to the cookie
aCookie.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(aCookie); //Set the cookie
}
}