public void RegenerateSessionID() { System.Web.SessionState.SessionIDManager manager = new System.Web.SessionState.SessionIDManager(); string oldId = manager.GetSessionID(Context); string newId = manager.CreateSessionID(Context); bool isAdd = false, isRedir = false; manager.SaveSessionID(Context, newId, out isRedir, out isAdd); }
public static void CacheTests_Initialize(TestContext testContext) { _SessionIdManager = new System.Web.SessionState.SessionIDManager(); _SessionStateSection = (SessionStateSection)WebConfigurationManager.GetSection("system.web/sessionState"); _ProviderSettings = (ProviderSettings)_SessionStateSection.Providers[_SessionStateSection.CustomProvider]; _TimeoutInSeconds = (int)_SessionStateSection.Timeout.TotalSeconds; UpdateHostingEnvironment(); }
public static void CacheTests_Initialize(TestContext testContext) { _SessionIdManager = new System.Web.SessionState.SessionIDManager(); _SessionStateSection = (SessionStateSection)WebConfigurationManager.GetSection("system.web/sessionState"); _ProviderSettings = (ProviderSettings)_SessionStateSection.Providers[_SessionStateSection.CustomProvider]; _TimeoutInSeconds = (int)_SessionStateSection.Timeout.TotalSeconds; UpdateHostingEnvironment(); }
public static string GetSessionId() { string sessionId = string.Empty; try { System.Web.SessionState.SessionIDManager Manager = new System.Web.SessionState.SessionIDManager(); sessionId = Manager.CreateSessionID(HttpContext.Current); } catch (Exception ex) { sessionId = "N/A"; } return(sessionId); }
public static void Test() { // http://stackoverflow.com/questions/5750203/how-to-write-unicode-characters-to-the-console System.Console.OutputEncoding = System.Text.Encoding.UTF8; System.Web.SessionState.SessionIDManager man = new System.Web.SessionState.SessionIDManager(); for (int i = 0; i < 100; ++i) { string sessid = man.CreateSessionID(null); int num = CountNumeric(sessid); System.Console.WriteLine(num.ToString() + ": " + sessid); string mySessId = RandomPassword(new SessionUidOptions()); System.Console.WriteLine(mySessId); // string pw = CreatePassword(8); // string pw = RandomPassword(new PasswordOptions()); // string pw = RandomPassword(new CyrillicPasswordOptions()); //string pw = RandomPassword(new GenericPasswordOptions() //{ // PASSWORD_CHARS_LCASE = "æaàâäbcçdeéêëfgiïîjklmnoœôöpqrstuùûüüvwxyÿz", // PASSWORD_CHARS_UCASE = "ÆAÀÂÄBCÇDEÉÊËFGHIÏÎJKLMNOŒÔÖPQRSTUÙÛÜÜVWXYŸZ", // PASSWORD_CHARS_NUMERIC = "0123456789", // PASSWORD_CHARS_SPECIAL = "*-+=_&!?$€£%{}()[]/\\|.:;", // NumberOfLowerCaseCharacters = 5, // NumberOfUpperCaseCharacters = 1, // NumberOfNumericCharacters = 3, // NumberOfSpecialCharacters = 1 //}); // string pw = RandomPassword(new SafePasswordOptions()); // System.Console.WriteLine(pw); } }
public void RegenerateSessionID() { System.Web.SessionState.SessionIDManager manager = new System.Web.SessionState.SessionIDManager(); string oldId = manager.GetSessionID(Context); string newId = manager.CreateSessionID(Context); bool isAdd = false, isRedir = false; manager.SaveSessionID(Context, newId, out isRedir, out isAdd); }