本文整理汇总了C#中System.Web.HttpSessionStateBase.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# HttpSessionStateBase.Clear方法的具体用法?C# HttpSessionStateBase.Clear怎么用?C# HttpSessionStateBase.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpSessionStateBase
的用法示例。
在下文中一共展示了HttpSessionStateBase.Clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetSessionData
public static HttpSessionStateBase SetSessionData(Dictionary<string,string> UserData, HttpSessionStateBase Session)
{
Dictionary<string, string> sessionData = new Dictionary<string, string>();
if(Session.Count > 0)
{
if (Session["LogInValue"] != null)
sessionData["LogInValue"] = EncrDecrAction.Decrypt(Session["LogInValue"].ToString(), true);
if (Session["LoggedIn"] != null)
sessionData["LoggedIn"] = EncrDecrAction.Decrypt(Session["LoggedIn"].ToString(), true);
if (Session["LoggedIn"] != null)
sessionData["UserId"] = EncrDecrAction.Decrypt(Session["UserId"].ToString(), true);
if (Session["UserRoleId"] != null)
sessionData["UserRoleId"] = EncrDecrAction.Decrypt(Session["RoleId"].ToString(), true);
if (Session["UserName"] != null)
sessionData["UserName"] = EncrDecrAction.Decrypt(Session["UserName"].ToString(), true);
if (Session["RoleName"] != null)
sessionData["RoleName"] = EncrDecrAction.Decrypt(Session["RoleName"].ToString(), true);
if (Session["ParentRoleName"] != null)
sessionData["ParentRoleName"] = EncrDecrAction.Decrypt(Session["ParentRoleName"].ToString(), true);
}
else
{
sessionData["LogInValue"] = EncrDecrAction.Decrypt(EncrDecrAction.Encrypt(UserData["LogInValue"], true), true);
sessionData["LoggedIn"] = EncrDecrAction.Decrypt(EncrDecrAction.Encrypt(UserData["UserName"], true), true);
sessionData["UserId"] = EncrDecrAction.Decrypt(EncrDecrAction.Encrypt(UserData["ID"], true), true);
sessionData["UserRoleId"] = EncrDecrAction.Decrypt(EncrDecrAction.Encrypt(UserData["UserRoleId"], true), true);
sessionData["UserName"] = EncrDecrAction.Decrypt(EncrDecrAction.Encrypt(UserData["UserName"], true), true);
sessionData["RoleName"] = EncrDecrAction.Decrypt(EncrDecrAction.Encrypt(UserData["RoleName"], true), true);
sessionData["ParentRoleName"] = EncrDecrAction.Decrypt(EncrDecrAction.Encrypt(UserData["ParentRoleName"], true), true);
}
Session.Clear();
Session["LogInValue"] = EncrDecrAction.Encrypt(sessionData["LogInValue"], true);
Session["LoggedIn"] = EncrDecrAction.Encrypt(sessionData["LoggedIn"], true);
Session["UserId"] = EncrDecrAction.Encrypt(sessionData["UserId"], true);
Session["UserRoleId"] = EncrDecrAction.Encrypt(sessionData["UserRoleId"], true);
Session["UserName"] = EncrDecrAction.Encrypt(sessionData["UserName"], true);
Session["RoleName"] = EncrDecrAction.Encrypt(sessionData["RoleName"], true);
Session["ParentRoleName"] = EncrDecrAction.Encrypt(sessionData["ParentRoleName"], true);
string encr = EncrDecrAction.Encrypt(
EncrDecrAction.Encrypt(EncrDecrAction.Encrypt(Session["UserId"].ToString(), true), true)
+ EncrDecrAction.Encrypt(EncrDecrAction.Encrypt(Session["UserRoleId"].ToString(), true), true)
+ EncrDecrAction.Encrypt(EncrDecrAction.Encrypt(Session["UserName"].ToString(), true), true)
+ EncrDecrAction.Encrypt(EncrDecrAction.Encrypt(Session["RoleName"].ToString(), true), true)
+ EncrDecrAction.Encrypt(EncrDecrAction.Encrypt(Session["ParentRoleName"].ToString(), true), true), true);
Session["SRES"] = encr;
HttpContext.Current.Session["SessionBackup"] = Session;
return Session;
}
示例2: ResetSession
/// <summary>
/// Clear session
/// </summary>
/// <param name="session">
/// The current <see cref="HttpSessionState"/>
/// </param>
//public static void ResetSession(HttpSessionState session)
public static void ResetSession(HttpSessionStateBase session)
{
if (session != null)
{
if (SessionQueryExistsAndIsValid(session))
{
GetSessionQuery(session).Reset();
GetSessionQuery(session).ResetDsds();
}
session.Clear();
}
}
示例3: destroy
internal static void destroy(HttpSessionStateBase session, HttpResponseBase response)
{
session.Clear();
session.Abandon();
response.Cookies.Remove("PaydromeUserLogin");
}
示例4: ClearSession
/// <summary>
/// Clears the session of all indexes & variables
/// </summary>
/// <param name="session"></param>
public static void ClearSession(HttpSessionStateBase session)
{
session.Clear();
session.Abandon();
}
示例5: ClearAll
/// <summary>
/// Clear All
/// </summary>
/// <param name="sessionState"></param>
public static void ClearAll(HttpSessionStateBase sessionState)
{
sessionState.Clear();
}