internal static HttpSessionStateWrapper CreateSessionWrapper(HttpSessionState httpSessionState) { HttpSessionStateWrapper httpSessionStateWrapper = new HttpSessionStateWrapper(httpSessionState); //if (httpSessionState.IsNewSession) // httpSessionStateWrapper.NotifyCreated(); return httpSessionStateWrapper; }
public CommandResult Run(HttpRequestData request, IOptions options, HttpSessionState session) { return new CommandResult() { HttpStatusCode = HttpStatusCode.NotFound }; }
public Message(HttpSessionState session, ServiceBroker servicebroker) { this.session = session; this.servicebroker = servicebroker; sessionid = session.SessionID; json = new JsonObject(); }
public void ProcessRequest(HttpContext context) { ses = context.Session; Guid id = new Guid(context.Request.QueryString["id"]); if (ChaptcaValues.ContainsKey(id)) { context.Response.ContentType = "image/jpeg"; Bitmap bm = new Bitmap(150, 30); Graphics g = Graphics.FromImage(bm); Font f = new Font("Comic Sans MS", 15f); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; g.DrawString(ChaptcaValues[id], f, Brushes.Blue, new RectangleF(0, 0, bm.Width, bm.Height), sf); bm.Save(context.Response.OutputStream, ImageFormat.Jpeg); } else { return; } }
public HttpSessionStateWrapper(HttpSessionState httpSessionState) { if (httpSessionState == null) { throw new ArgumentNullException("httpSessionState"); } _session = httpSessionState; }
public void NotifyObserver(HttpSessionState currentSession, bool isFinised) { const string message = "finished."; if (NotifyLogger != null) NotifyLogger(message); //+ "\n" var args = new NotificationEventArgs(currentSession, message, isFinised); OnAsyncNotificationEvent(args);//for web }
public void retrieveCurrency(System.Web.SessionState.HttpSessionState session) { ExternalFunctions myExternalFunctions = new ExternalFunctions(); DataTable currencies = myExternalFunctions.getCurrencyData(); session["currency"] = currencies; }
/// <summary> /// Invokes the appropriate service handler (registered using a ServiceAttribute) /// </summary> public void InvokeServiceHandler(Message request, Message response, HttpSessionState session, HttpResponse httpresponse) { if (request.Type.Equals(this.Request)) { try { Message temp_response = response; Object[] parameters = new Object[] { request, temp_response }; Object declaringTypeInstance = Activator.CreateInstance(this.MethodInfo.DeclaringType); this.MethodInfo.Invoke(declaringTypeInstance, parameters); temp_response = (Message)parameters[1]; temp_response.Type = this.Response; temp_response.Scope = request.Scope; temp_response.Version = request.Version; temp_response.RequestDetails = request.RequestDetails; Logger.Instance.Debug("Invoked service for request: " + request.Type); Dispatcher.Instance.EnqueueOutgoingMessage(temp_response, session.SessionID); } catch (Exception e) { String err = ""; err+="Exception while invoking service handler - " + this.MethodInfo.Name + " in " + this.MethodInfo.DeclaringType.Name + "\n"; err += "Request Message - " + request.Type + "\n"; err += "Response Message - " + response.Type + "\n"; err += "Message - " + e.Message + "\n"; err += "Stacktrace - " + e.StackTrace + "\n"; Logger.Instance.Error(err); } } }
public void Invoke(HttpSessionState session, DataInputStream input) { _result = HttpProcessor.GetClient<PhotoServiceSoapClient>(session).GetPhotosForCollection( input.ReadString(), input.ReadString(), input.ReadInt32()); }
public static void Insert(byte method, HttpSessionState session, string login, long user_id, string url, string appsession) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LelandsConnectionString"].ConnectionString); try { SqlCommand cmd = new SqlCommand("exec spDebuging_Insert @u, @s, @g, @m, @url, @cid, @gcid", conn); cmd.Parameters.Add("@u", SqlDbType.BigInt).Value = user_id; cmd.Parameters.Add("@s", SqlDbType.VarChar, 255).Value = session.SessionID; cmd.Parameters.Add("@g", SqlDbType.VarChar, 255).Value = user_id == -1? String.Empty : GetSessionID(login,user_id); cmd.Parameters.Add("@m", SqlDbType.TinyInt).Value = method; cmd.Parameters.Add("@url", SqlDbType.VarChar, 1024).Value = url; cmd.Parameters.Add("@cid", SqlDbType.BigInt).Value = -1; cmd.Parameters.Add("@gcid", SqlDbType.VarChar, 255).Value = appsession; conn.Open(); cmd.ExecuteNonQuery(); } catch (Exception) { } finally { if (conn.State == ConnectionState.Open) conn.Close(); } }
public void Invoke(HttpSessionState session, DataInputStream input) { _result = HttpProcessor.GetClient<TagServiceSoapClient>(session).UploadTags( input.ReadString(), input.ReadString(), input.ReadTagUpdate()); }
public void Invoke(HttpSessionState session, DataInputStream input) { HttpProcessor.GetClient<MemberServiceSoapClient>(session).SetMemberStatusText( input.ReadString(), input.ReadString(), input.ReadString()); }
public List<Node> Dump(HttpSessionState session) { return session.Keys.Cast<string>() .OrderBy(x => x) .Select(x => Process("item", x, session[x], 0)) .ToList(); }
public void CarregarValores(HttpSessionState Session, string sWhere = "") { if (this.DataSource == null) { string sDataTable = "DataTable" + this.ID; DataTable dtValores = (DataTable)Session[sDataTable]; //if (dtValores == null) { Tabela oTabelas = ((UsuarioWeb)Session["ObjetoUsuario"]).oTabelas; StringBuilder strExpressao = new StringBuilder(); strExpressao.Append(sExpressaoSqlDadosConsulta); strExpressao.Replace("<CD_EMPRESA>", "'" + oTabelas.sEmpresa + "'"); strExpressao.Replace("<CD_VEND>", "'" + oTabelas.CdVendedorAtual + "'"); if (sWhere != "") { strExpressao.Append(" Where " + sWhere); } dtValores = oTabelas.hlpDbFuncoes.qrySeekRet(strExpressao.ToString()); Session[sDataTable] = dtValores; } this.DataSource = dtValores; this.DataBind(); } }
public void Invoke(HttpSessionState session, DataInputStream input) { _result = HttpProcessor.GetClient<CommentServiceSoapClient>(session).GetComment( input.ReadString(), input.ReadString(), input.ReadInt32()); }
public void clearSessionError(HttpSessionState session) { if (session["login"] != null) { session.Remove("login"); } }
public CCUtility(object parent){ Session=HttpContext.Current.Session; Server=HttpContext.Current.Server; Request=HttpContext.Current.Request; Response=HttpContext.Current.Response; DBOpen(); }
/// <summary> /// A constructor. /// </summary> /// <param name="e_game_type">A type of a game</param> /// <param name="queryString">URL query string</param> /// <param name="userSessionID">User's session ID from Session object</param> /// <param name="gameSessionID">Game session ID</param> public GameServiceProxy(EGameType e_game_type, string queryString, string userSessionID, string gameSessionID, HttpSessionState Session) { if (GS == null) { GS = new com.sanuko.www.GameService(); } if (gameSessionID == null) { this.gameSessionID = ""; } else { this.gameSessionID = gameSessionID; } this.Session = Session; this.e_game_type = e_game_type; this.queryString = queryString.Replace("?", "").Replace("&", ";"); if (userSessionID == null) { this.userSessionID = ""; } else { this.userSessionID = userSessionID; } }
/// <summary> /// Usess the request or session SA value along with the session MasterAcctPID value to /// determine if the logged in patron can impersonate the patron with the SA patron id. /// </summary> /// <param name="request"></param> /// <param name="session"></param> /// <returns></returns> public FamilyRelationship ValidImpersonation(HttpRequest request, HttpSessionState session) { string sa; if(string.IsNullOrEmpty(request[SessionKey.SA]) && (session[SessionKey.SA] == null || string.IsNullOrEmpty(session[SessionKey.SA].ToString()))) { return null; } if(!string.IsNullOrEmpty(request[SessionKey.SA])) { sa = request[SessionKey.SA]; session[SessionKey.SA] = sa; } else { sa = session[SessionKey.SA].ToString(); } var parent = Patron.FetchObject((int)session[SessionKey.MasterAcctPID]); if(!parent.IsMasterAccount || !Patron.CanManageSubAccount(parent.PID, int.Parse(sa))) { return null; } return new FamilyRelationship { PatronId = int.Parse(sa), ParentPatronId = parent.PID }; }
public static IList<ISearchJobDto> getRecentSearchJobs(HttpSessionState session) { SessionKey key = SessionKey.SearchJobs; if(get(key, session) == null) set(key, session, new List<ISearchJobDto>()); return get(key, session) as IList<ISearchJobDto>; }
/// <summary> /// ����IHttpHandler���� /// </summary> /// <param name="context"></param> public void ProcessRequest(HttpContext context) { Request = context.Request; Response = context.Response; Session = context.Session; VerifyImage dt_verifyImage = new VerifyImage(); dt_verifyImage._Random = new Random(); dt_verifyImage._Code = dt_verifyImage.GetRandomCode(); dt_verifyImage.BackColor = ColorTranslator.FromHtml("#edf8fe"); Session["SystemCode"] = dt_verifyImage._Code; ///����û�л��� Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.Expires = 0; Response.CacheControl = "no-cache"; Response.AppendHeader("Pragma", "No-Cache"); Bitmap objBitmap = dt_verifyImage.GetVerifyImage(); objBitmap.Save(Response.OutputStream, ImageFormat.Gif); if (null != objBitmap) objBitmap.Dispose(); Response.ContentType = "image/gif"; Response.Write(Response.OutputStream); }
internal void RaiseOnEnd(HttpSessionState sessionState) { if (this._sessionEndEventHandlerCount > 0) { HttpApplicationFactory.EndSession(sessionState, this, EventArgs.Empty); } }
public void Invoke(HttpSessionState session, DataInputStream input) { _result = HttpProcessor.GetClient<DashboardServiceSoapClient>(session).GetThumbnail( input.ReadString(), input.ReadString(), input.ReadString()); }
public static void SaveIntegrationSession(HttpSessionState session, string endpointUri, string apiKey, string dataServiceEndpoint, string activeUserName) { session[Constants.SessionApiKey] = apiKey; session[Constants.SessionLodEndpoint] = endpointUri; session[Constants.SessionDataServiceEndpoint] = dataServiceEndpoint; session[Constants.SessionActiveUserName] = activeUserName; }
internal void RaiseOnEnd(HttpSessionState sessionState) { Debug.Trace("SessionOnEnd", "Firing OnSessionEnd for " + sessionState.SessionID); if (_sessionEndEventHandlerCount > 0) { HttpApplicationFactory.EndSession(sessionState, this, EventArgs.Empty); } }
/// <summary> /// Converts a standard <see cref="HttpRequest"/> to a <see cref="RequestModel"/> /// Copies over: URL, HTTP method, HTTP headers, query string params, POST params, user IP, route params /// </summary> /// <param name="request"></param> /// <param name="session"></param> /// <param name="scrubParams"></param> /// <returns></returns> public static RequestModel CreateFromHttpRequest(HttpRequest request, HttpSessionState session, string[] scrubParams = null) { var m = new RequestModel(); m.Url = request.Url.ToString(); m.Method = request.HttpMethod; m.Headers = request.Headers.ToDictionary(); m.Session = session.ToDictionary(); m.QueryStringParameters = request.QueryString.ToDictionary(); m.PostParameters = request.Form.ToDictionary(); // add posted files to the post collection if (request.Files.Count > 0) foreach (var file in request.Files.Describe()) m.PostParameters.Add(file.Key, "FILE: " + file.Value); // if the X-Forwarded-For header exists, use that as the user's IP. // that will be the true remote IP of a user behind a proxy server or load balancer m.UserIp = IpFromXForwardedFor(request) ?? request.UserHostAddress; m.Parameters = request.RequestContext.RouteData.Values.ToDictionary(v => v.Key, v => v.Describe()); if (scrubParams != null) { m.Headers = Scrub(m.Headers, scrubParams); m.Session = Scrub(m.Session, scrubParams); m.QueryStringParameters = Scrub(m.QueryStringParameters, scrubParams); m.PostParameters = Scrub(m.PostParameters, scrubParams); } return m; }
public static string GetMessageForUser(HttpSessionState session) { if (UserHaveMessage(session)) return session[USER_MESSAGE].ToString(); else return string.Empty; }
public static Bubis.Andika.DAL.EF.Users GetUser(HttpSessionState session) { if (UserIsAuthenticated(session)) return session[SESSION_USER] as Bubis.Andika.DAL.EF.Users; else throw new Bubis.Andika.Core.Exceptions.SessionExpiredException(); }
/// <summary> /// Handles the id PSSO request. /// </summary> /// <param name="context">The context.</param> /// <param name="request">The request.</param> /// <param name="response">The response.</param> /// <param name="session">The session.</param> private void HandleIdPSSORequest(HttpContext context, HttpRequest request, HttpResponse response, HttpSessionState session) { if (request.Cookies[FormsAuthentication.FormsCookieName] == null) return; var cookiestr = request.Cookies[FormsAuthentication.FormsCookieName].Value; var tkt = FormsAuthentication.Decrypt(cookiestr); if (tkt == null) return; var attributes = new MultiStringDictionary { {Constants.SUBJECT, tkt.Name}, {"NickName", "defaultNickName"}, {"Role", "Admin"} }; if (request[Constants.RESUME_PATH] == null) return; var attributesToSend = new MultiStringDictionary(); foreach (var pair in attributes) { var key = pair.Key; foreach (string value in pair.Value) { attributesToSend.Add(key, value); } } var strRedirect = "https://" + ConfigurationManager.AppSettings["PFHost"] + request[Constants.RESUME_PATH]; strRedirect = SetOpenToken(context, strRedirect, attributesToSend); response.Redirect(strRedirect, true); }
public void Invoke(HttpSessionState session, DataInputStream input) { HttpProcessor.GetClient<AskServiceSoapClient>(session).CompleteQuestion( input.ReadString(), input.ReadString(), input.ReadString()); }
internal static void FCKClearTempStore(HttpSessionState session) { if (session == null) return; var uploads = session["tempFCKUploads"] as List<FCKTempUploadsInfo>; if (uploads == null) return; IDataStore store = null; foreach (var u in uploads.Where(u => u.Files.Count > 0)) { if (store == null) store = StorageFactory.GetStorage(u.TenantID.ToString(), "fckuploaders"); if (u.IsEdit) { foreach (var fileName in u.Files) store.DeleteFiles(u.StoreDomain, u.FolderID, fileName.ToLower(), false); } else { store.DeleteFiles(u.StoreDomain, u.FolderID, "*", false); } } }
public static void addToCart(DataTable dtSku, String q, System.Web.SessionState.HttpSessionState Session) { int t = Convert.ToInt32(q); int u = Convert.ToInt32("" + dtSku.Rows[0]["SpecialPrice"]); int TotalPrice = t * u; FrontendCartDAO fec = new FrontendCartDAO(); Dictionary <string, string> paramDic = new Dictionary <string, string>(); paramDic.Add("@AddToCart_UserID", Session["UserID"].ToString()); paramDic.Add("@AddToCart_ProductID", dtSku.Rows[0]["ImageNewID"] + ""); paramDic.Add("@AddToCart_AddToCartName", "" + Session["UserName"]); paramDic.Add("@AddToCart_ImagePath", ConfigUtil.getServerPath() + dtSku.Rows[0]["PathInternaldetailsSmallImage"]); paramDic.Add("@AddToCart_BrandName", "" + dtSku.Rows[0]["SKUBrand"]); paramDic.Add("@AddToCart_ProductName", "" + dtSku.Rows[0]["SKUName"]); paramDic.Add("@AddToCart_Color", "" + dtSku.Rows[0]["Color"]); paramDic.Add("@AddToCart_Size", "" + dtSku.Rows[0]["Size"]); paramDic.Add("@AddToCart_EstimatedDelivery", "2-5 days"); paramDic.Add("@AddToCart_TimeRemainning", "This item is no longer reserved."); paramDic.Add("@AddToCart_UnitPrice", "" + dtSku.Rows[0]["SpecialPrice"]); paramDic.Add("@AddToCart_Quantity", "" + t); paramDic.Add("@AddToCart_TotalPrice", TotalPrice.ToString()); paramDic.Add("@AddToCart_Description", "International orders are final sale and non-returnable."); paramDic.Add("@AddToCart_CreatedName", "" + Session["UserName"]); paramDic.Add("@AddToCart_RecordStatus", "1"); paramDic.Add("@AddToCart_ProductSKUCode", "" + dtSku.Rows[0]["SKUCode"]); paramDic.Add("@AddToCart_ShippingReturns", "" + dtSku.Rows[0]["ShippingReturns"]); fec.AddToCartByUser(paramDic); }
public static void WebControlsLocalization(System.Web.SessionState.HttpSessionState session, ControlCollection ctrls) { //System.Globalization.CultureInfo ci = GetSessionUICultureInfo(session); //System.Threading.Thread.CurrentThread.CurrentUICulture;//HROne.Common.WebUtility.GetSessionCultureInfo(session); //WebControlsLocalization(ctrls, ci); ////initLanguage(session); LocalizationProcess localizationProcess = new LocalizationProcess(GetDatabaseConnection(session), GetSessionUICultureInfo(session)); localizationProcess.WebControlsLocalization(ctrls); }
public static CurrentUser GetCurrentUser(string logonName) { // if _userProps is null or logon does not match then get new identity props from the DB System.Web.SessionState.HttpSessionState session = HttpContext.Current.Session; CurrentUser user = session["CurrentUser"] as CurrentUser; string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString(); if (user == null || !string.Equals(user.LoginName, logonName, StringComparison.OrdinalIgnoreCase)) { user = new CurrentUser(logonName, logFilePath, ""); session["CurrentUser"] = user; } return(user); }
public static string GetSelectedPallets(string palletTypeCountCSV) { System.Web.SessionState.HttpSessionState currentSession = HttpContext.Current.Session; currentSession[s_selectedPalletTypeCounts] = null; // Reset Session Variable, as new call. currentSession[s_palletDeliveries] = null; // Reset Session Variable, as new call. string retVal = string.Empty; List <Entities.PalletTypeCount> selectedPalletTypeCounts = new List <Entities.PalletTypeCount>(); try { if (palletTypeCountCSV.Length == 0) { throw new Exception(); } string[] selectedRows = palletTypeCountCSV.Split('|'); foreach (string s in selectedRows) { string[] rowItems = s.Split(','); Entities.PalletTypeCount palletTypeDetails = new Entities.PalletTypeCount(int.Parse(rowItems[0]), int.Parse(rowItems[1]), rowItems[2], int.Parse(rowItems[3])); selectedPalletTypeCounts.Add(palletTypeDetails); } currentSession[s_selectedPalletTypeCounts] = selectedPalletTypeCounts; retVal = "complete"; } catch (Exception ex) { retVal = "There was an error retrieving your selection, please reload the page and try again."; } return(retVal); }
private SpecificViewBuilder specificViewBuilder = null;// cached, for re-building on View-refresh. /// <summary> /// Ctor() /// - CacherDbView creates a dbView onConstruction /// NB. crucial for the Ctor() success is the call to this.GetChunk(firstPage) /// this.GetChunk() sets this.Session[CacherDbView] and this is the condition to /// let the dbView available; otherwise every call to /// </summary> public CacherDbView( //---first the Cacher needs: System.Web.SessionState.HttpSessionState Session , string where_tail , string view_signature , SpecificViewBuilder specificViewBuilder , int RowsInChunk //---below follows the Pager need: , System.Web.HttpRequest Request , System.Web.UI.WebControls.GridView grdDatiPaginati , System.Web.UI.WebControls.Panel pnlPageNumber ) { if ( null == view_signature || "" == view_signature.Trim() || char.IsDigit(view_signature[0]) ) { throw new System.Exception("CacherDbView::Ctor: illegal view name."); }// else can continue. this.ViewName = view_signature; // try { this.doDestruction();// NB. be sure to drop omonimous objects, before a new fill( eg. for a different DataGrid in the same Session). // this.specificViewBuilder = specificViewBuilder; this.specificViewBuilder(where_tail, this.ViewName); // this.where_tail = where_tail; // if (RowsInChunk > 0) { this.RowsInChunk = RowsInChunk; } else { this.RowsInChunk = 5;// default. } // System.Data.DataTable dtViewRowCardinality = Entity.Proxies.usp_ViewCacher_generic_LOAD_length_SERVICE.usp_ViewCacher_generic_LOAD_length( view_signature); if ( null == dtViewRowCardinality || 0 >= dtViewRowCardinality.Rows.Count ) { LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( " exception : CacherDbView Ctor failed querying the VIEW row-cardinality. check for View existence. " , 0); }// else continue this.rowCardinality = (int)(dtViewRowCardinality.Rows[0].ItemArray[0]); // //---done with the Cacher, now do the Pager. // now fill the first page, after the View creation. this.Pager_EntryPoint( // --- TODO debug Session , Request , grdDatiPaginati , pnlPageNumber ); } catch (System.Exception ex)// the provided DataTable might be null; { // Logging string m = ex.Message; throw new System.Exception(" CacherDbView Ctor failed creating the VIEW. "); } }// end Ctor
}// /// <summary> /// /// Responsabile della creazione dinamica degli indici di pagina disponibili. /// Visualizza massimo dieci pagine, centrate in quella selezionata. /// Se ce ne sono meno di dieci vanno visualizzate tutte quelle disponibili, centrate /// in quella selezionata. /// </summary> /// /// <param name="paginaDesiderata">viene decisa dal chiamante, che e' this.Pager_EntryPoint, in base /// al parametro "parPage", passato in Request, dallo href dell'indice selezionato. /// In ogni caso in cui manchi il parametro parPage nella url la paginaDesiderata viene portata /// ad "1" di default, e la visualizzazione va da uno alla ultima disponibile, /// col vincolo di non superare l'indice dieci. /// </param> /// private void PageIndexManager( System.Web.SessionState.HttpSessionState Session , System.Web.HttpRequest Request , int paginaDesiderata , System.Web.UI.WebControls.Panel pnlPageNumber , out System.Data.DataTable dt ) { int totaleRighe = this.rowCardinality;// tested. //----range check------- if (0 >= this.RowsInChunk) { throw new System.Exception(" non-positive number of rowsPerPage required. "); }// can continue. // int pagineDisponibili = (int)System.Math.Ceiling((double)totaleRighe / (double)this.RowsInChunk); int pagineDisponibiliLeft = paginaDesiderata - 1; int pagineDisponibiliRight = pagineDisponibili - paginaDesiderata; int paginaMinima = (paginaDesiderata - 4 > 0) ? paginaDesiderata - 4 : 1; int pagineUtilizzateASinistra = paginaDesiderata - paginaMinima; int pagineDisponibiliADestra = 10 - (pagineUtilizzateASinistra + 1); int paginaMassima = (paginaDesiderata + pagineDisponibiliADestra <= pagineDisponibili) ? paginaDesiderata + pagineDisponibiliADestra : pagineDisponibili; // // decorazione html.table all'interno del panel string currentFullPath = Request.AppRelativeCurrentExecutionFilePath; string currentPage = currentFullPath.Substring(currentFullPath.LastIndexOf('/') + 1); string rawUrl = Request.RawUrl; LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( "App_Code::CacherDbView::PageIndexManager: debug QueryStringParser. " + " whole_Query_string = " + rawUrl , 0); string remainingQueryString = ""; string queryStringPreesistente = ""; int questionMarkIndex = rawUrl.IndexOf('?', 0, rawUrl.Length); if (-1 == questionMarkIndex) // caso NON esistano altri get-params { queryStringPreesistente = "?"; // NB. dbg 20100712 remainingQueryString = ""; }// end caso NON esistano altri get-params else// caso esistano altri get-params { remainingQueryString = rawUrl.Substring(questionMarkIndex + 1); int indexStartParPage = remainingQueryString.IndexOf("parPage=", 0, remainingQueryString.Length); int indexEndParPage = -1; string prefix = ""; // porzione queryString precedente "parPage=xxx" string suffix = ""; // porzione queryString successiva "parPage=xxx" if (-1 == indexStartParPage) { indexEndParPage = -1; prefix = rawUrl.Substring(questionMarkIndex + 1); } else { if (0 == indexStartParPage) { prefix = ""; } else if (0 < indexStartParPage) { prefix = remainingQueryString.Substring(0, indexStartParPage - 1);// exclude '&' at end. } indexEndParPage = remainingQueryString.IndexOf("&", indexStartParPage); } if (-1 != indexEndParPage) { suffix = remainingQueryString.Substring(indexEndParPage);// da '&' compreso } else { suffix = ""; } queryStringPreesistente = "?" + prefix + suffix;// Query String privata del parPage if (1 < queryStringPreesistente.Length) { queryStringPreesistente += "&"; } // else nothing to add. } // end caso esistano altri get-params // // clean the dynamic-html panel-content, before re-filling. int dbg_controlsInDynamicPanel = pnlPageNumber.Controls.Count; pnlPageNumber.Controls.Clear(); // for (int c = paginaMinima; c <= paginaMassima; c++) { System.Web.UI.WebControls.LinkButton x = new System.Web.UI.WebControls.LinkButton(); x.ID = "pag_" + c.ToString(); x.Text = " " + c.ToString() + " "; x.Visible = true; x.Enabled = true; x.Attributes.Add("href", currentPage + queryStringPreesistente + "parPage=" + c.ToString());// parametro_Get per specificare la redirect_Page // if (paginaDesiderata == c) { x.ForeColor = System.Drawing.Color.Yellow; System.Web.UI.WebControls.Unit selectedPage_fontSize = x.Font.Size.Unit; x.Font.Size = new FontUnit(/*selectedPage_fontSize.Value + */ 24.0); x.Font.Bold = true; } // pnlPageNumber.Controls.Add(x); }// end loop of addition of dynamic link buttons System.Web.UI.WebControls.Label y = new System.Web.UI.WebControls.Label(); y.Text = " (totale " + pagineDisponibili.ToString() + " pagine)"; pnlPageNumber.Controls.Add(y); //-----------------------------------------END dynamic html------------------------------------- // dt = // out par------------------------------ this.GetChunk( Session , paginaDesiderata ); }// end PageIndexManager
/// <summary> /// 画面起動時に実行されるイベントハンドラ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { //画面にエラーメッセージ・エラー情報を表示する----------------------------- //エラーメッセージをHTTPコンテキストから取得 string err_msg = (string)HttpContext.Current.Items[FxHttpContextIndex.SYSTEM_EXCEPTION_MESSAGE]; //エラー情報をHTTPコンテキストから取得 string err_info = (string)HttpContext.Current.Items[FxHttpContextIndex.SYSTEM_EXCEPTION_INFORMATION]; //画面にエラーメッセージを表示する this.Label1.Text = CustomEncode.HtmlEncode(err_msg); //画面にエラー情報を表示する this.Label2.Text = CustomEncode.HtmlEncode(err_info); // ------------------------------------------------------------------------ //画面にフォーム情報を表示する--------------------------------------------- //HTTPリクエスト フォーム情報 HttpRequest req = HttpContext.Current.Request; //コレクション System.Collections.Specialized.NameValueCollection froms = req.Form; if (froms != null) { //foreach foreach (string strKey in froms) { if (froms[strKey] == null) { al_form.Add(new PositionData(strKey, "null")); } else { al_form.Add(new PositionData(strKey, CustomEncode.HtmlEncode(froms[strKey].ToString()))); } } //データバインド this.Repeater1.DataSource = al_form; this.Repeater1.DataBind(); } // ------------------------------------------------------------------------ // 画面にセッション情報を表示する------------------------------------------ //HTTPセッション情報 System.Web.SessionState.HttpSessionState sess = HttpContext.Current.Session; if (sess != null) { //foreach foreach (string strKey in sess) { if (sess[strKey] == null) { al_session.Add(new PositionData(strKey, "null")); } else { al_session.Add(new PositionData(strKey, CustomEncode.HtmlEncode(sess[strKey].ToString()))); } } //データバインド this.Repeater2.DataSource = al_session; this.Repeater2.DataBind(); } // ------------------------------------------------------------------------ // セッション情報を削除する------------------------------------------------ if ((bool)HttpContext.Current.Items[FxHttpContextIndex.SESSION_ABANDON_FLAG]) { // 2009/09/18-start // セッション タイムアウト検出用Cookieを消去 // ※ Removeが正常に動作しないため、値を空文字に設定 = 消去とする // Set-Cookie HTTPヘッダをレスポンス Response.Cookies.Set(FxCmnFunction.DeleteCookieForSessionTimeoutDetection()); // 2009/09/18-end try { // セッションを消去 Session.Abandon(); } catch (Exception ex2) { // エラー発生時 // このカバレージを通過する場合、 // おそらく起動した画面のパスが間違っている。 Console.WriteLine("このカバレージを通過する場合、おそらく起動した画面のパスが間違っている。"); Console.WriteLine(ex2.Message); } } }
internal SessionOnEndTargetWorkItem(SessionOnEndTarget target, HttpSessionState sessionState) { this._target = target; this._sessionState = sessionState; }
public UserSession(System.Web.SessionState.HttpSessionState toSession) { this.moSession = toSession; }
public static AdminRightsChecker SetUserPrivileges(HttpCookie username, System.Web.SessionState.HttpSessionState Session) { return(new AdminRightsChecker(username, Session)); }
void OnAcquireState(object o, EventArgs args) { HttpApplication application = (HttpApplication)o; HttpContext context = application.Context; bool required = (context.Handler is IRequiresSessionState); // This is a hack. Sites that use Session in global.asax event handling code // are not supposed to get a Session object for static files, but seems that // IIS handles those files before getting there and thus they are served without // error. // As a workaround, setting MONO_XSP_STATIC_SESSION variable make this work // on mono, but you lose performance when serving static files. if (sessionForStaticFiles && context.Handler is StaticFileHandler) { required = true; } // hack end if (!required) { return; } bool read_only = (context.Handler is IReadOnlySessionState); bool isNew = false; HttpSessionState session = null; if (handler != null) { session = handler.UpdateContext(context, this, required, read_only, ref isNew); } if (session != null) { if (isNew) { session.SetNewSession(true); } if (read_only) { session = session.Clone(); } context.SetSession(session); HttpRequest request = context.Request; HttpResponse response = context.Response; string id = context.Session.SessionID; if (isNew && config.CookieLess) { request.SetHeader(HeaderName, id); UriBuilder newUri = new UriBuilder(request.Url); newUri.Path = UrlUtils.InsertSessionId(id, request.FilePath); response.Redirect(newUri.Uri.PathAndQuery); } else if (isNew) { HttpCookie cookie = new HttpCookie(CookieName, id); cookie.Path = request.ApplicationPath; context.Response.AppendCookie(cookie); } if (isNew) { OnSessionStart(); HttpSessionState hss = application.Session; if (hss != null) { handler.Touch(hss.SessionID, hss.Timeout); } } } }
/// <summary> /// 跳转到提示页面 /// </summary> /// <param name="response">传入Response</param> /// <param name="session">传入Session</param> /// <param name="tip">提示信息</param> /// <param name="url">跳转Url</param> public static void goRedirect(HttpResponse response, System.Web.SessionState.HttpSessionState session, string tip, string url) { session.Add("tip", tip); response.Redirect("~/redirect.aspx?url=" + url); }
/// <summary> /// 检查是否已登陆 /// </summary> /// <param name="Session">Session</param> /// <returns>true已登陆,false未登陆</returns> public static bool CheckLoged(System.Web.SessionState.HttpSessionState Session) { return(!(Session["uid"] == null)); }
void OnAcquireRequestState(object o, EventArgs args) { Trace.WriteLine("SessionStateModule.OnAcquireRequestState (hash " + this.GetHashCode().ToString("x") + ")"); HttpApplication application = (HttpApplication)o; HttpContext context = application.Context; if (!(context.Handler is IRequiresSessionState)) { Trace.WriteLine("Handler (" + context.Handler + ") does not require session state"); return; } bool isReadOnly = (context.Handler is IReadOnlySessionState); bool supportSessionIDReissue; if (idManager.InitializeRequest(context, false, out supportSessionIDReissue)) { return; // Redirected, will come back here in a while } string sessionId = idManager.GetSessionID(context); handler.InitializeRequest(context); GetStoreData(context, sessionId, isReadOnly); storeIsNew = false; if (storeData == null && !storeLocked) { storeIsNew = true; sessionId = idManager.CreateSessionID(context); Trace.WriteLine("New session ID allocated: " + sessionId); bool redirected; bool cookieAdded; idManager.SaveSessionID(context, sessionId, out redirected, out cookieAdded); if (redirected) { if (supportSessionIDReissue) { handler.CreateUninitializedItem(context, sessionId, (int)config.Timeout.TotalMinutes); } context.Response.End(); return; } else { storeData = handler.CreateNewStoreData(context, (int)config.Timeout.TotalMinutes); } } else if (storeData == null && storeLocked) { WaitForStoreUnlock(context, sessionId, isReadOnly); } else if (storeData != null && !storeLocked && storeSessionAction == SessionStateActions.InitializeItem && IsCookieLess(context, config)) { storeData = handler.CreateNewStoreData(context, (int)config.Timeout.TotalMinutes); } container = CreateContainer(sessionId, storeData, storeIsNew, isReadOnly); SessionStateUtility.AddHttpSessionStateToContext(app.Context, container); if (storeIsNew) { OnSessionStart(); HttpSessionState hss = app.Session; if (hss != null) { storeData.Timeout = hss.Timeout; } } }
/// <summary> /// 获取用户的ID /// </summary> /// <param name="session">session</param> /// <returns>返回uid</returns> public static int GetCurrentUid(System.Web.SessionState.HttpSessionState session) { return(int.Parse(session["uid"].ToString())); }
public static void PageStateChecker_SERVICE( string PageSignature, System.Web.HttpRequest Request, bool IsPostBack, System.Web.SessionState.HttpSessionState Session ) { // ReEntrantChecker.ReEntrantChecker_SERVICE(//-------------NB.--------------------- Request , Session ); // /* * NB. page state check.----------------------------------------------------------------- * */ if ( !IsPostBack &&//------------------------------------------------------false !((bool)(Session["IsReEntrant"])) //-----------------------------false ) { // first absolute entrance LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( PageSignature + " : IsPostBack, IsReEntrant = false, false. " , 0 ); RunTimeDebugger.RunTimeDebugger_SERVICE(Session); } else if ( !IsPostBack &&//----------------------------------------------------false (bool)(Session["IsReEntrant"]) //-_-----------------------------true ) { // coming from html-numbers of pager LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( PageSignature + " : IsPostBack, IsReEntrant = false, true. " , 0 ); RunTimeDebugger.RunTimeDebugger_SERVICE(Session); // needed combo-refresh, but re-select combo-Value from Session -------- } else if ( IsPostBack &&//------------------------------------------------------true !(bool)(Session["IsReEntrant"]) //------------------------------false ) { LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( PageSignature + " : IsPostBack, IsReEntrant = true, false. " , 0 ); RunTimeDebugger.RunTimeDebugger_SERVICE(Session); } else if ( IsPostBack &&//------------------------------------------------------true (bool)(Session["IsReEntrant"]) //-------------------------------true ) { // coming from combo-index-changed. LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( PageSignature + " : IsPostBack, IsReEntrant = true, true. " , 0 ); RunTimeDebugger.RunTimeDebugger_SERVICE(Session); } // no "else" possible: case mapping is complete. } // end SERVICE
public static void SaveUseInfo(SessionInfo oSessionInfo, System.Web.SessionState.HttpSessionState oSession) { oSession.Add(sUserInfoID, oSessionInfo); }
public override void Create(System.Web.SessionState.HttpSessionState mySession) { base.Create(mySession); #region recupera le informazioni dalla sessione login = new InnerLogin(); if (session && pgSession["login"] != null) { login = ((InnerLogin)pgSession["login"]); pgSession.Remove("login"); } #endregion recupera le informazioni dalla sessione #region calcola operazione if (action != null && action == "login") { if (force) { myAction = Actions.DoForcedLogin; } else { login.IdAmministrazione = (string)this.Context.Request.Params["cmbamministrazioni"]; login.UserId = (string)this.Context.Request.Params["userid"]; login.UserPwd = (string)this.Context.Request.Params["password"]; myAction = Actions.DoLogin; } } else { if (force) { myAction = Actions.AskForForcedLogin; } else { login.ErrorMessage = (string)this.Context.Request.Params["error"]; myAction = Actions.ShowForm; } } #endregion calcola operazione #region esegue operazione switch (myAction) { case Actions.ShowForm: /*Integrazione IAM*/ string policyAgent = null; policyAgent = ConfigSettings.getKey(ConfigSettings.KeysENUM.POLICY_AGENT_ENABLED); if (policyAgent != null && policyAgent.ToUpper() == Boolean.TrueString.ToUpper()) { /*caso query string*/ //if (Request.QueryString["exit"] != null && (Request.QueryString["exit"].ToString().ToUpper() == Boolean.TrueString.ToUpper())) /*fine caso query string*/ if (Session["exit"] != null && Convert.ToBoolean(Session["exit"].ToString())) { Session.Clear(); LogoutMessage = "Logout effettuato con successo"; UserId = VICLoad.amData.account.ToString(); } else { if (forced) { string url = EnvironmentContext.RootPath + "exit.aspx"; Response.Redirect(url, true); } else { this.ExecuteLogin(); } } /*fine Integrazione IAM*/ } //delegato alla componente aspx break; case Actions.DoLogin: //esegue l'operazione di login e predispone il risultato ExecuteLogin(); break; case Actions.AskForForcedLogin: //delegato alla componente aspx break; case Actions.DoForcedLogin: //esegue l'operazione di login e predispone il risultato ExecuteForcedLogin(); break; } #endregion esegue operazione }
// Notify System Operators about an exception public static void NotifySystemOps(Exception exc, string source, System.Web.SessionState.HttpSessionState Session) { MailMessage mail = new MailMessage(new MailAddress("*****@*****.**"), new MailAddress("*****@*****.**")); SmtpClient mailer = new SmtpClient("owa13.Sullivan.edu"); mail.Bcc.Add(new MailAddress("*****@*****.**")); //Body string body = "<br/>" + "********** " + DateTime.Now + " " + HttpContext.Current.Request.Url.AbsoluteUri + " **********"; if (exc.InnerException != null) { body += "<br/>" + "Inner Exception Type: "; body += "<br/>" + exc.InnerException.GetType().ToString(); body += "<br/>" + "Inner Exception: "; body += "<br/>" + exc.InnerException.Message; body += "<br/>" + "Inner Source: "; body += "<br/>" + exc.InnerException.Source; if (exc.InnerException.StackTrace != null) { body += "<br/>" + "Inner Stack Trace: "; body += "<br/>" + exc.InnerException.StackTrace; } } body += "<br/>" + "Exception Type: "; body += "<br/>" + exc.GetType().ToString(); body += "<br/>" + "Exception: " + exc.Message; body += "<br/>" + "Source: " + source; body += "<br/>" + "Stack Trace: "; if (exc.StackTrace != null) { body += "<br/>" + exc.StackTrace; body += "<br/>"; } try { body += "<strong>Session: </strong>"; foreach (string key in Session.Keys) { body += "<br />"; body += "<strong>" + key + "</strong><br />"; try { Dictionary <string, string> vals = (Dictionary <string, string>)Session[key]; foreach (KeyValuePair <string, string> de in vals) { body += de.Key + " | " + de.Value.ToString() + "<br />"; } } catch (Exception ex) { } try { Dictionary <object, object> vals = (Dictionary <object, object>)Session[key]; foreach (KeyValuePair <object, object> de in vals) { body += de.Key + " | " + de.Value.ToString() + "<br />"; } } catch (Exception ex) { } } } catch (Exception ex) { } mail.Subject = "System Error: " + ConfigurationManager.AppSettings["AppName"]; mail.IsBodyHtml = true; mail.Body = body; mailer.EnableSsl = false; try { mailer.Send(mail); } catch (Exception ex) { } }
}// end TryRoleChecker /// <summary> /// 0 unlogged /// 1 admin /// 2 writer /// 3 reader /// </summary> /// <returns></returns> public static int RoleCheckerQuery( System.Web.SessionState.HttpSessionState Session, string UserHostAddress ) { int res = default(int); object lasciapassare = Session["lasciapassare"]; Entity.BusinessEntities.Permesso.Patente actualLasciapassare = default(Entity.BusinessEntities.Permesso.Patente); LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( "RoleCheckerQuery for host " + UserHostAddress, 0); // if ( null == lasciapassare ) { return(0);//cannot enter. }// else continue. string username = default(string); int id_user = default(int); // try { actualLasciapassare = (Entity.BusinessEntities.Permesso.Patente)lasciapassare;// here throws, if cast fails. username = actualLasciapassare.username; id_user = actualLasciapassare.id_username; if ( "utente not found" == username || 0 == id_user ) { throw new System.Exception("Allarme: avvenuto ingresso di utente NON riconosciuto. "); }// else can enter. Session["errore"] = null; // still don't know WHO is logged, so nothing about "res" yet. } catch (System.Exception ex) { LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( "VerificaLasciapassare: rilevato tentativo di violazione dell'area riservata. " + " IP client=" + UserHostAddress + " SessionId=" + Session.SessionID + " Ex = " + ex.Message, 0 ); Session["errore"] = "Credenziali non riconosciute."; res = -1;// unlogged return(res); } // // if (// Administrator: enables LogViewing, more than writing. "admin" == username ) { res = 1; } else if (// writer "Sandro Francesconi" == username || "Thomas Albarello" == username || "Daniela Pichierri" == username ) { res = 2; } else {// reader res = 3; } Session["RoleChecker"] = res;//----NB.-------------- // ready // return(res); } //
public void initializeAjaxController( System.Web.HttpRequest _request, System.Web.SessionState.HttpSessionState _session, System.Web.HttpResponse _response, System.Web.HttpServerUtility _server) { try { this.response = _response; this.request = _request; this.session = _session; this.server = _server; Thread.CurrentThread.CurrentCulture = new CultureInfo("nb-NO", false); www.fwInitialize("", "", request, session, response); ajax.Initialize(www); if (ajax.sProcedure == "init_ajax_web_form()") { ajax.setProcedure("init_bank()"); StringBuilder sb = new StringBuilder(); sb.Append(get_start_form("")); ajax.WriteHtml("bank_content", sb.ToString()); ajax.WriteXmlToClient(); } else if (ajax.sProcedure == "send_phone()") { string sPhone = ajax.getString("parameter_1"); if (sPhone.Trim().Length != 8) { ajax.WriteHtml("bank_content", get_start_form(sPhone)); } else { BankDatabaseService bankDatabase = new BankDatabaseService(); bool bExists = bankDatabase.bankPhoneExist(sPhone); bankDatabase.save_phone(sPhone); ajax.WriteVariable("status", "true"); ajax.WriteHtml("bank_content", phone_saved()); } ajax.WriteXmlToClient(); return; } sGlobalAjaxPrefix = ajax.getString("global_session_prefix"); string sGlobalSessionPrefix = (string)www.fwGetSessionVariable("global_session_prefix"); // A) NONE Ajax - prefix and NONE session : Just return. if (isBlank(sGlobalAjaxPrefix) && isBlank(sGlobalSessionPrefix)) { return; } // B) Ajax - prefix and NONE session - prefix. SAVE NEW. if (!isBlank(sGlobalAjaxPrefix) && isBlank(sGlobalSessionPrefix)) { www.fwSetSessionVariable("global_session_prefix", sGlobalAjaxPrefix); ajax.WriteVariable("initiating", "true"); global = (BankGlobal)www.fwGetSessionVariable(sGlobalAjaxPrefix + "_global"); if (global == null) { global = new BankGlobal(); www.fwSetSessionVariable(sGlobalAjaxPrefix + "_global", global); ajax.WriteVariable("initiating", "true"); return; } return; } // C) session - prefix. Just Go On if (!isBlank(sGlobalSessionPrefix)) { global = (BankGlobal)www.fwGetSessionVariable(sGlobalSessionPrefix + "_global"); return; } } catch (Exception) { } }
/// <summary> /// Initializes a new instance of <see cref="HttpSessionState"/>. /// </summary> /// <param name="session">The <see cref="System.Web.SessionState.HttpSessionState"/> to wrap.</param> public HttpSessionState(System.Web.SessionState.HttpSessionState session) { _session = session; }
public SessionForPage(string pPageName, System.Web.SessionState.HttpSessionState pSession) { _session = pSession; _PageName = pPageName; }
public virtual void Create(System.Web.SessionState.HttpSessionState mySession) { pgSession = mySession; }
protected void Application_AcquireRequestState(object sender, EventArgs e) { System.Web.SessionState.HttpSessionState Session = System.Web.HttpContext.Current.Session; HttpRequest Request = System.Web.HttpContext.Current.Request; string[] host = Request.Url.Host.Split('.'); if (Session != null && Session.IsNewSession && (host[0].ToLower() == "demo" || host[0].ToLower() == "freecases")) { // temporarily saving user agent strings, gotta catch that google bot. var userAgentString = Request.UserAgent; /* using (StreamWriter sw = new StreamWriter(Server.MapPath("~/Logs/ua.txt"), true)) * { * sw.WriteLine(userAgentString); * }*/ // end of temp saving UserData ud = UserMng.Login("sysdemo", ConfigurationManager.AppSettings["DEMO_USER_PASS"], false, Request.UserHostAddress); if (ud != null) { if (ud.SessionId > 0) { Session["UserData"] = ud; Session.Timeout = ud.SessionTimeout; // minutes var productsList = UserMng.GetProductsList(ud.UserId); Session["ProductsList"] = productsList; var selectedProductCookie = Request.Cookies["SelectedProductId"]; int selectedProductId = 1; if (ud.Products.Where(p => p.IsActive.HasValue && p.IsActive == true).ToList().Count == 1) { selectedProductId = ud.Products.FirstOrDefault().ProductId; var newCookie = new HttpCookie("SelectedProductId"); newCookie.Value = selectedProductId.ToString(); Response.SetCookie(newCookie); } else { if (selectedProductCookie != null && selectedProductCookie.Value != null && selectedProductCookie.Value.ToString() != "") { selectedProductId = int.Parse(selectedProductCookie.Value.ToString()); } } Session["SelectedProductId"] = selectedProductId; } } } if (Session != null) { if (Request.Cookies["sitelang"] != null) { Language currentLang = InterfaceLanguages.GetLanguageByCode(Request.Cookies["sitelang"].Value); if (!currentLang.IsInterfaceLang) // some bad cookie { currentLang = null; } if (currentLang != null) // check if cookie contains valid language code, mmmmmm cookieeee (Cookie monster was here) { Session["LanguageId"] = currentLang.Id; } } if (Session["LanguageId"] == null) { Language preferedLang = null; string languageCode; if (Request.UserLanguages != null) { foreach (var headerLang in Request.UserLanguages) { languageCode = headerLang.Split(';')[0]; if (languageCode.Length == 2) { preferedLang = InterfaceLanguages.GetLanguageByShortCode(languageCode); } else { preferedLang = InterfaceLanguages.GetLanguageByCode(languageCode); } if (preferedLang != null && !preferedLang.IsInterfaceLang) { preferedLang = null; } if (preferedLang != null) { break; } } } if (preferedLang == null) { preferedLang = InterfaceLanguages.GetLanguageById(Convert.ToInt32(ConfigurationManager.AppSettings["DefaultLanguageId"])); } Session["LanguageId"] = preferedLang.Id; //HttpCookie cultureCookie = new HttpCookie("sitelang", defaultLang.Code); //cultureCookie.Expires = DateTime.Now.AddYears(1); //Response.Cookies.Add(cultureCookie); } string code = InterfaceLanguages.GetLanguageById(Convert.ToInt32(Session["LanguageId"])).Code; CultureInfo ci = new CultureInfo(code); System.Threading.Thread.CurrentThread.CurrentCulture = ci; System.Threading.Thread.CurrentThread.CurrentUICulture = ci; if (Request.Cookies["SelectedProductId"] != null) { Session["SelectedProductId"] = Request.Cookies["SelectedProductId"].Value.ToString(); } if (Session["SelectedProductId"] == null) { Session["SelectedProductId"] = 1; } // Refreshing language to english in T&FSt if previously another not primary language has been selected. Sry for this. Blame it on the financists. if (Convert.ToInt32(Session["SelectedProductId"]) == 2 && Convert.ToInt32(Session["LanguageId"]) > 4 && Session["UserData"] != null && ((Session["UserData"] as UserData).ClientId != 1 || (Session["UserData"] as UserData).Username.ToUpper() == "SYSDEMO")) // Apis Europe client ignore { Session["LanguageId"] = 4; // english var newLangCookie = new HttpCookie("sitelang"); newLangCookie.Value = "en-GB"; newLangCookie.Expires.AddYears(365); Response.SetCookie(newLangCookie); } } }