4

好的,所以我正在使用 AJAX 和 Windows Live ID SDK 开发 ASP.NET webapp。我已成功通过 Live 对其进行身份验证,但是...

Windows Live ID 规范表明我必须查找请求标头“login”、“logout”和“clearcookie”。推荐的代码示例包括一个 Response.Redirect,当您的页面大量使用 UpdatePanel 时,它似乎不起作用:

loginCookie = new HttpCookie(strLoginCookie);
loginCookie.Expires = DateTime.Now.AddYears(-10);
Response.Cookies.Add(loginCookie);
Response.Redirect("default.aspx");
Response.End();

此外,clearcookie 操作要求我直接写入响应:

public WindowsLiveLogin wll = new WindowsLiveLogin(key1, key2);

loginCookie = new HttpCookie(strLoginCookie);
loginCookie.Expires = DateTime.Now.AddYears(-10);
Response.Cookies.Add(loginCookie);

string type;
byte[] content;
wll.GetClearCookieResponse(out type, out content);
Response.ContentType = type;
Response.OutputStream.Write(content, 0, content.Length);

结果,响应无法识别它并且 Windows Live 注销功能超时,无论是通过我的注销按钮(注销操作)还是 Windows Live 站点的注销功能(清除 cookie 操作)。如何使用标记中的静态 UpdatePanel 和其他 AJAX 控件来实现这一点?

我在以前的 AJAX 项目中使用过它。我决定没有注销功能,当然可以通过清除一个人的 cookie 来绕过它。请告诉我一个更优雅的方式!

4

0 回答 0