/// <summary> /// Throw WebFaultException with error code 403 forbidden if /// session id and token are not valid. /// </summary> /// <param name="sessionManager"></param> /// <param name="sid"></param> /// <param name="token"></param> public static void Session(SessionManager sessionManager, int sid, string token) { int userid; string site; if (!sessionManager.ValidateSession(sid, token, out userid, out site)) throw new WebFaultException(System.Net.HttpStatusCode.Forbidden); }
/// <summary> /// Throw WebFaultException with error code 403 forbidden if /// session id and token are not valid for the user specified by userId /// and if the /// </summary> /// <param name="sessionManager"></param> /// <param name="sid"></param> /// <param name="token"></param> /// <param name="userId"></param> /// <param name="allowManageOverride"></param> public static void Session(SessionManager sessionManager, int sid, string token, int userId, bool allowManageOverride) { if (!sessionManager.ValidateSession(userId, token, sid) && (!allowManageOverride || !sessionManager.ValidateSession(SessionManager.MANAGE_ID, token, sid))) throw new WebFaultException(System.Net.HttpStatusCode.Forbidden); }