session-state

Session Objects not Updating ASP.NET

限于喜欢 提交于 2019-12-05 05:40:51
I set a session object at one juncture in my code: Session("my_name") = "Dave" Later in my code I give the user a chance to update this object: Session("my_name") = TextBox1.Text I reload my page and display a little hello statement like this: Label1.Text = "Hello" & CStr(Session("my_name")) The result is: "Hello Dave" no matter what I change Session("my_name") too. EDIT: Here is the a full code-behind I wrote up to demonstrated: Public Class WebForm1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.Cache

Enabling Session State in SharePoint 2010?

耗尽温柔 提交于 2019-12-05 03:57:07
I have a web service built for SharePoint 2007 that I am trying to port to SharePoint 2010. This web service is dependent on session state to function properly, but so far, I have been enable to get session state to work at all in SharePoint 2010. This web service runs as its own web application under t he /_vti_bin virtual directory. I have tried all of the following with no luck: Ensured the "State Service" service application is running. Added the System.Web.SessionState.SessionStateModule http module to my application's web.config file. Added the System.Web.SessionState.SessionStateModule

What is the difference between Session.Abandon() and Session.Clear() in ASP.Net?

白昼怎懂夜的黑 提交于 2019-12-04 23:54:18
What is the difference between Session.Abandon() and Session.Clear() in ASP.Net? Session.Abandon() will end the current session. Session_End will be fired and the next request will fire the Session_Start event. Session.Clear will just clear the session data and the the session will remain alive. Session ID will remain the same in both cases, as long as the browser is not closed. In a nutshell: Session.Abandon(); cancels the current Session . Session.Clear(); clears all values from Session state. Session.Abandon() will destroy/kill the entire session. Session.Clear() removes/clears the session

is it a good idea to create an enum for the key names of session values?

此生再无相见时 提交于 2019-12-04 18:52:58
问题 instead of doing session("myvar1") = something session("myvar2") = something session("myvar3") = something session("myvar4") = something is doing enum sessionVar myvar1 myvar2 myvar3 myvar4 end enum session(sessionVar.myvar1.tostring) = something session(sessionVar.myvar2.tostring) = something session(sessionVar.myvar3.tostring) = something session(sessionVar.myvar4.tostring) = something would be better? 回答1: Instead of using constants for the session keys, I'm using my own type-safe session

Why is it considered a good practice to make session scoped objects Serializable?

只愿长相守 提交于 2019-12-04 17:13:02
I often hear people saying that session scoped objects should implement Serializable ? Why it is so ? What will be the result if one doesn't do this ? Why not make this a part of the servlet specification then ? I know Tomcat doesn't complain if we do not do this . What about other app servers like JBoss, WebSphere or Weblogic ? This allows the servlet container to either store the contents of a session on disk, or to transfer session contents over the network to another server. Why does the container need to store session on the disk (passivation)? Perhaps when the memory is full. When the

Tomcat 7 : Redirect URL in case of session timeout

血红的双手。 提交于 2019-12-04 16:33:22
I have following configuration in web.xml in tomcat 7. I am wondering if I can add any configurable parameter here, so that if user tries to do any operation post 30 minutes, I redirect the user to our home page. <session-config> <session-timeout>30</session-timeout> <cookie-config> <domain>mydomain.mycompany.com</domain> <http-only>true</http-only> <secure>false</secure> </cookie-config> <tracking-mode>COOKIE</tracking-mode> </session-config> ohwhy This is probably not possible by configuration only. You will have to add a filter aswell. One way of doing that is described here: https:/

Sharing Session State between different .NET Versions using State Server

喜夏-厌秋 提交于 2019-12-04 16:27:54
问题 Background We have one website running on IIS 6 (Win2003 Server) using .NET 3.5: site1.mysite.local We have a second website running on IIS 7 (Win2008 Server) using .NET 4.0: site2.mysite.local On each site, the web.config contains the StateServer and the same machineKey: <sessionState mode="StateServer" stateConnectionString="tcpip=STATESRV01:42424" /> <machineKey decryptionKey="EDCDA6DF458176504BBCC720B4E29348E252E652591179E2" validationKey=

How to make stateless web applications? Especially with Spring MVC?

微笑、不失礼 提交于 2019-12-04 15:58:42
The stateless web application seems promising . How to make one? Especially with Spring WebMvc? Any guidelines? Here are a few things on my mind: Avoid creating session Use a centralized storage for state info and share that among web application instances. ADD 1 I think it is not a question of whether to keep state info or not. State info is always necessary if you want to do something useful. It is actually a question where/how to keep the state info. This article is useful. It mentioned in-proc/out-of-proc session, data cache, and why not to use session. Related: Use Spring MVC for

How to retrieve a generic list from session?

倖福魔咒の 提交于 2019-12-04 13:27:31
问题 I have a list that I put in session: Session.Add("SessionList", mylist); How to retrieve it back from the session? 回答1: var list = Session["SessionList"] as List<whatevertypeYouUsed>; if (list != null){ // blah... } I prefer to use the as keyword since there is no 100% guarantee that the Session will contain the list (due to application pool refresh, website being restarted, etc). Gives you that extra bit of defence to avoid a NullReferenceException . 回答2: Try var myList = (List

Migrating web farm to runtime version 4 of asp.net while maintaining session

我只是一个虾纸丫 提交于 2019-12-04 12:38:50
We've migrated our webapplication from .net runtime 2 (v 3.5) to .net runtime 4 (v 4.5) and I have a question for deployment. Our sessionstate server is a "stateserver", and runs aspnetsession from framework 2 on a separate server. When we deploy and upgrade the application pool to .net 4 to one of our webservers in test, it seems that the session expires or is dropped somehow as we're redirected to the logon page of our application. Is there any way of deploying our new version of the app without our users losing session in the process? Are the sessioncookie created by application pools