session-state

When is session state initialized in the ASP.NET pipeline

柔情痞子 提交于 2019-12-05 23:29:17
问题 I have an IHTTPModule with an event handler for AuthorizeRequest. I would like to access the Session object but it is not yet initialized. Which event should I subscribe to in order to have the session object available as early as possible in the pipeline? 回答1: You needd HttpApplication.PostAcquireRequestState event - http://msdn.microsoft.com/en-us/library/system.web.httpapplication.postacquirerequeststate.aspx. Also there is a HttpApplication.AcquireRequestState event. Don't forget to check

Should this “singleton” be thread-safe in an ASP.NET app?

江枫思渺然 提交于 2019-12-05 23:07:08
Note that "singleton" used in slightly uncommon sense - "object visible as single instance like HttpContext.Current" unlike normal "object with one shared instance". I make use of a singleton type of UserContext class for my asp.net MVC applications. This class allows me to store user data as a strongly-typed session object. I ran across this CodeReview question and wondered if it was necessary to be concerned about thread safety in this application context. Here's a simplification of my code: public class UserContext { private UserContext() { } public static UserContext Current { get { if

Session timeout issue in php

本小妞迷上赌 提交于 2019-12-05 18:46:33
I have set session timeout time for 20 Minutes as below.Sometime the session timeout is happening in two or three minutes. ini_set('session.gc_maxlifetime', 1200); ini_set('session.cookie_lifetime', 1200); ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 100); What could be the issue? The 20 minute expiration does not reset when the user browses other pages. The problem is explained in this comment : As PHP's Session Control does not handle session lifetimes correctly when using session_set_cookie_params(), we need to do something in order to change the session expiry time

How in ASP.NET, do you deal with session and multiple tabs?

假如想象 提交于 2019-12-05 18:06:27
I have written an application in ASP.net, that is designed to let the user add records to a database. The page is set up that when a user adds a record, the ID number of the newly added record is set in session, the page Response.Redirects to a "Thank you for submitting" page, then redirects back to the original page to allow further edits. Users can also use the Back button on this screen to go back to the original record adding page, which allows them to make edits to the data. However, I have found that storing the ID in session isn't a terribly good solution, as a user might try to create

regenerateExpiredSessionId not working as expected

纵然是瞬间 提交于 2019-12-05 16:17:58
It is my understanding, according to the MSDN, that regenerateExpiredSessionId="true" specifies that the session ID will be reissued when an expired session ID is specified by the client. However, this does not seem to be working as described. Let's say you have an application configured as follows: <sessionState cookieless="AutoDetect" regenerateExpiredSessionId="true" /> And somewhere else, you have a link to a page in that application in which an expired session ID is embedded: <p><a href="http://localhost/SessionStateTest/(S(3gxng155isp0ocvhveoklnqe))/Default.aspx">Here is a link!</a></p>

How to get SessionID on a request where EnableSessionState=“False”

风流意气都作罢 提交于 2019-12-05 14:19:35
I want to be able to get the SessionID of the currently authenticated session in a WebMethod function where EnableSession = false . I cannot set EnableSession=true on this request, because another (long running) request on a different page is keeping the SessionState locked (EnableSessionState == "True" not "Readonly"). Is there a consistent way of getting the SessionID from either the ASP.NET Session cookie or the Url for cookieless sessions? I can code it myself but I would rather use a function that is already documented and tested. Thank you very much, Florin. There seems to be no ASP.NET

Use Spring Web Flow without state on the server

两盒软妹~` 提交于 2019-12-05 10:26:40
I'm reading the Spring Web Flow chapter in the book Pro Spring MVC. Unfortunately there's no explicit information, where the state during a flow execution is persisted. I assume it is saved in the JVM Heap and associated with the session. Now HTTP is a stateless protocol (REST...) and I'd like to use Spring Web Flow without saving state on the server (besides the one and only state that a session might be authenticated). One strategy is to send all parameters of the entire flow with every HTTP request of the flow (hidden input) and thus accumulating all necessary parameters until the flow has

How do I maintain a server-side state with Snap Framework?

青春壹個敷衍的年華 提交于 2019-12-05 08:52:55
Server-side sessions are not [yet] part of the Snap Framework. Is there a way to add some sort of server side state? Let's pretend I want to increment a counter for each HTTP request. How would I do it? Easiest way is to put the state behind an mvar: fooHandler :: MVar Int -> Snap () fooHandler mvar = do x <- liftIO $ modifyMVar mvar $ \y -> let y'=y+1 in (y',y') writeBS $ S.pack $ "Incremented counter to: " ++ show x Initialize the mvar when the site is initialized. Hope this helps. The above answer is correct as far as it goes, but it doesn't deal with some real issues. First up is server

Hibernate: Could not synchronize database state with session [duplicate]

瘦欲@ 提交于 2019-12-05 07:47:14
Possible Duplicate: Hibernate: different object with the same identifier value was already associated with the session While trying to insert a new entry to a Many TO Many associated table , i am getting this error: Could not synchronize database state with session I can understand that this is something deals with getSession() & session.close() But i cant able to figure it out exactly. For each transaction i am creating a new session. But i close all the sessions at the user logout. i.e: Creating a hibernate session & binds it with HttpSession. Then i destroys it in the user logout. Some

How can i change session when open url in another tab in asp.net

时间秒杀一切 提交于 2019-12-05 06:43:00
问题 I am developing one web application in asp.net. I am opening my all pages on pop up window. I want to expire my session or change the session value when someone copy the url and paste it into another tab. How can i implement it ? Please help me out. 回答1: A simple way would be to check Request.UrlReferrer. The Referrer would be empty if the user copy pastes a URL. A couple of points you should consider before using this: Provide exceptions for any pages that can be directly entered by the user