/// <summary> /// add cookie to request cookie container /// </summary> /// <param name="Key">request key</param> /// <param name="name">cookie name</param> /// <param name="value">cookie value</param> /// <param name="path">cookie save path in server</param> /// <param name="domain">cookie domain</param> protected void AddNewCookie(string name, string value, string path, string domain, string Key = null) { try { var request = ProgramStorageQueries.GetRequest(Key); var cookie = new Cookie(name, VariableAnalysis.ExecuteVariableCommand(value) ?? value, path, domain); var cookieContainer = ProgramStorageQueries.GetCookieContainer(ProgramStorageQueries.GetRequestKey(request)); cookieContainer.Add(cookie); request.CookieContainer = cookieContainer; } catch (Exception e) { CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER); } }
/// <summary> /// Show current request /// </summary> protected void ShowCurrentRequest() { try { var request = ProgramStorageQueries.GetCurrentRequest(); var key = ProgramStorageQueries.GetRequestKey(request); CMD.ShowApplicationMessageToUser($"{key}\t{request.RequestUri}"); } catch (Exception e) { CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER); } }