当前位置: 首页>>代码示例>>C#>>正文


C# HttpSessionStateBase.Clear方法代码示例

本文整理汇总了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;
        }
开发者ID:atiquereza,项目名称:DigitalVaccinationApp,代码行数:54,代码来源:SessionHandler.cs

示例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();
            }
        }
开发者ID:alcardac,项目名称:SDMX_DATA_BROWSER,代码行数:20,代码来源:SessionQueryManager.cs

示例3: destroy

 internal static void destroy(HttpSessionStateBase session, HttpResponseBase response)
 {
     session.Clear();
     session.Abandon();
     response.Cookies.Remove("PaydromeUserLogin");
 }
开发者ID:ju2cho7,项目名称:aerodrome,代码行数:6,代码来源:SessionHelper.cs

示例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();
 }
开发者ID:nissafors,项目名称:Bibblan,代码行数:9,代码来源:AccountHelper.cs

示例5: ClearAll

 /// <summary>
 /// Clear All
 /// </summary>
 /// <param name="sessionState"></param>
 public static void ClearAll(HttpSessionStateBase sessionState)
 {
     sessionState.Clear();
 }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:8,代码来源:SessionManager.cs


注:本文中的System.Web.HttpSessionStateBase.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。