如果你有一個例外,並且你知道它爲什麼被拋出。唯一的辦法就是在你的代碼中處理它,在你的網站上註銷用戶。
嘗試搜索檢查這個錯誤的一些變種,像this:
if(ex.Message == "The session is invalid because the user logged out")
{
//timeout caused by user logging out of FB (auth token remains in qstring)
Session.Remove("Facebook_session_key");
Session.Remove("Facebook_userId");
Session.Remove("Facebook_session_expires");
//redirect to login
Response.Redirect(@"http://www.Facebook.com/login.php?api_key=" + fbService.ApplicationKey + @"&v=1.0\");
}
您也應該檢查exception的ErrorType
屬性:
/// <summary>
/// A value representing the specific type of error returned by Facebook.
/// </summary>
public enum ErrorType
{
///<summary>
///</summary>
Unknown = 1,
///<summary>
///</summary>
ServiceUnavailable = 2,
///<summary>
///</summary>
RequestLimit = 4,
///<summary>
///</summary>
Timeout = 102,
///<summary>
///</summary>
Signing = 104,
///<summary>
///</summary>
InvalidUser = 110,
///<summary>
///</summary>
InvalidAlbum = 120,
///<summary>
///</summary>
UserNotVisible = 210,
///<summary>
///</summary>
AlbumNotVisible = 220,
///<summary>
///</summary>
PhotoNotVIsible = 221,
///<summary>
///</summary>
InvaldFQLSyntax = 601
}