session-state

How to change sqlConnectionString for sessionState in SQLServer mode at runtime?

Hello, We're trying to find a way to change the sessionState's sqlConnectionString (in SQLServer mode) at runtime. We're implementing a fail over for our SQL server and we want to catch when the sessionState fails to have access to my SQL server and tell it to fail over to my secondary server and initialize the site-wide fail over at th...

Stop site reusing session id on expiry

Hi people. I want to be able to log when a user ends their session on our application and record whether it was a sign out or a the session expired. I am using cookies.Add(new HttpCookie("ASP.NET_SessionId", "")); to set a new sessionId on sign out, but when the session expires, the sessionId is reused if the browser instance is no...

Login issues on shared SQLServer session state of web-farm

Per a question I posted yesterday, our website's DNS structure has changed to round-robin DNS which literally swaps back and and forth between two production servers. Our web.config for both prod servers has: <sessionState mode="SQLServer" ... > pointing to the same shared DB A machineKey on each server that is consistent between the t...

Enabling/Disabling CSS based on Session value using MVC

I am rather new to MVC applications, and one thing I am trying to accomplish is enabling or disabling stylesheets based on a Session value. I have stylesheets referenced in my Site.Master page in this manner: <%=Html.Stylesheet("~/styles/main.css", "string")%> <%=Html.Stylesheet("~/styles/additions.css", "string")%> Right now, for tes...

Handler with IRequiresSessionState does not extend session timeout

I have a handler, like this, using IRequiresSessionState: public class MyHandler : IHttpHandler, IRequiresSessionState { // code } In the code, I am able to read and set Session values. I also check ensure that the caller is logged in. That all works fine. The web site uses forms authentication, so in the web.config, I have this: ...

Session Storage and pagination mvc

Hi I'm not sure if this is the best approach so hoping for some advice. I have a pager that updates the page using ajax. I'd like the user to be able to select the size of the page they require I'm doing this with a form and some jquery which calls an action method that sets the Session["PageSize"] value which is used to determine how ...

C#.net webform, avoid losing data from session timeout

I have a user complaining about frequent timeouts in my Intranet web page. While looking for a solution I found this post: http://forums.asp.net/t/152925.aspx?PageIndex=1 Where a poster recommends intercepting the redirect to the login page, submit the data to the database, then either reauthorize the user (without their knowledge) or...

asp.net inproc vs out of proc performance

Hi, I'm considering moving our web app session storage from In Proc to State Server. Can anybody give any figures as to the performance difference? ...

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

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? ...

Anyone can explain the meaning of session states in SQL Server, such as sleeping, suspended, running etc

Hi, I'm confused about the session states of SQL Server sessions. Anyone can explain it please? Thanks. ...

Session.Clear() vs. Session.RemoveAll()

Is there a difference between Session.Clear() and Session.RemoveAll()? The descriptions and documentation pages seem to say exactly the same thing, but I am assuming there must be some reason for creating two functions, right? Thanks. ...

Object losing reference when assigning it to Session??

Hello, I am facing a very strange issue. I get an error Object Reference Not set to instance of object on the server while the code runs fine on my dev machine. The strange part is the line number where the code is throwing error (as appears in the Stack trace) DemoUser demoUser = new DemoUser(); if (!Request.QueryString.AllKeys.Conta...

Need help tracking down sporadic "Unable to serialize the session state" server errors.

We have been receiving reports of the following server error periodically from users. [OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown.] [HttpException (0x80004005): Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session stat...

ASP.NET State Service Losing Sessions on App Pool Recycle

Hello All, I am in dire need of a better way to handle sessions. We currently use default in-proc (IIS Worker Process) for our ASP.NET MVC web apps. I am now trying to implement ASP.NET State Service locally on the web server. I have installed and enabled the service (also set it up to start automatically). I believe that we're succ...

ASP.NET session id shared amongst browser tabs

I've recently been developing a website using asp.net webforms that uses in proc sessions and I noticed that session ids are shared amongst browser tabs. So I was wondering what you would do for the following situations: Problem: Multiple logins with different users in the one browser problem User opens browser tab 1, logins with "...

Configure ASP.NET Session State at runtime

We have an ASP.NET web site that uses SQL Server session state. The state is configured in Web.config like: <sessionState mode="SQLServer" sqlConnectionString="data source=TheServer; User ID=TheUser;password=ThePassword;" cookieless="false" timeout="480"/> But there are three environments (development / staging / production). Al...

How to best fix an InProc session state variable \ multi instance problem?

I've recently been tasked with fixing a rather nasty bug resulting from the misuse of session state. We have an asp.net web application that runs on a single sever using inproc session state. The basic design is that a typed dataset is loaded from the database and stored in session state using a common session variable name like Session...

Session expiring after 20 minutes: Whether idle or not.

I'm having some trouble with users losing session data whilst going through an application form. It appears that they're losing session state part way through application forms. (ASP.NET 4.0 WebForms project, IIS 6.0) Session is stored out-of-process in the state server so it's not config changes, appdomain recycling, etc AFAIK. <sessi...

Session loss analysis

Hi, our web application frequently losses it's session state (user is being logged out very often). I predict that the reason of such behavior are some exceptions thrown and unhandled in side threads of application or whole application restart. I'm pretty sure that it's not caused by recycle worker, because it happens in irregular peri...