C# - Unable To Share Session State Between 2 Web Apps With StateServer?

Jul 20, 2010

I'm having trouble getting 2 identical ASP.NET MVC applications to share the same Session using a Session StateServer. The reason I'm trying to do this is we will eventually be deploying this app across 3 web servers that need to share the same state. We need to use StateServer because we are trying to minimise use of the db for non data-related storage.

The Setup: I've deployed the same code base to http://localhost/App1 and http://localhost/App2

both have identical Web.Config files with the following:

<sessionState mode="StateServer"
cookieless="false" [code]....

The Result:For both deployments, when the page first loads I can see that the mode is StateServer and the timestamp is getting set to the same time as the realtime value.. However, if this was working, only the first page should have the same time as the realtime value. The second page load should read from the StateServer because that timestamp value is no longer null, and display that time value. But instead, it's displaying the realtime value again.

When I refresh the page, I the timestamp stays the same and the realtime value is always updating. This indicates that the timestamp is being saved to the Session, but the time stamp value is always different for both deployments when it should be the same, so this indicates that the Session is not being shared.

View 4 Replies

Similar Messages:

State Management :: Unable To Serialize The Session State In 'StateServer' And 'SQLServer' Mode

Dec 12, 2010

I am new to .net 4.0 and am using EF Model and SessionState Mode=SqlServer and I am getting this error below:

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

I checked the stack trace and its complaining about

[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("PoplarGroveModel", "tblMenuRole", "tblMenu", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(PoplarGroveDataModel.Menu), "tblRole",


I marked it as serializable but then it complains about System.Data.Objects.ObjectContext is not marked as serializable and hence throws the same error.

View 1 Replies

State Management :: When To Use SQLServer Or StateServer Session Mode

Feb 13, 2011

Just wanted to know in which type of web application we can use out proc session state mode?

View 2 Replies

State Management :: Session Does Not Get Saved If SessionState Mode Is StateServer

Mar 16, 2011

My session variables don't get saved if the SessionState mode in the web.config file is set to StateServer. But when I changed it to InProc, then everything is fine and good. I'm trying to save a custom built object (or class) into the session after the user logs in.

View 4 Replies

Security :: Persisting Session State Across Sub-domains (different Apps)

Jun 17, 2010

got [URL] - two separate apps in IIS.

Want the forms based auth to persist (they use the same database for membership)

I tried to simply add a "." before the domain name in the forms tags (see below for example) - but this didn't work - it acutally prevented me from logging in at all. how i can persist the login? Does the admin need the same values for "name", "path" and "domain" as the main site?


View 1 Replies

Web Forms :: 3.5 Error: Unable To Make The Session State Request To The Session State Server?

Dec 7, 2010

Have not run the ASP.NET Development Server for a while. Today I copied a production website to my workstation and ran it with VS 2008. The following error message popped up. What is the problem with the ASP.NET development Server on my workstation? The website on the Production server still ran okay.Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of KEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesaspnet_stateParametersAllowRemoteConnection.
If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '' as the server name.

View 2 Replies

Share Session State Between Two WCF Different Services?

Mar 16, 2010

I have two WCF services configured with ASP.NET compatible mode to allow them to use ASP.NET session state. The problem is as follows:

1.- A call to the first service stores a value in the ASP.NET session state.
2.- A second call to the first service can read that value.

3.- A call to the second service can't read the ASP.NET session state value.

It seems that the ASP.NET session state is not shared between the two WCF services. Is there a way to share ASP.NET Session state between two WCF Services?

View 2 Replies

To Share Session State Between Asp Classic And .net?

Jan 20, 2011

We are migrating an ASP Classic website over to ASP.Net. One of the big hurdles is the large amount of data stored in SessionState by the ASP Classic website.

I am looking for ways that session state can be shared between the two applications. I found the following link from microsoft MSDN that describes how to share session with a shared database. Unfortunately it uses the binary formatter to serialize into the database and I have recently had some bad experiences with said binary serialization.

how to share session state? or alternatives to the binary serialization?

View 3 Replies

State Management :: Different Browsers Share Same Session ID?

Apr 27, 2010

I am using cookieless session manangement in ASP.NET 1.1. When the session is active and the user uses the same url in a new browser window or a new browser in different machine. since the session is active the url will validate itself. When user open new window with same session, i want show some custom meesage.

View 8 Replies

State Management :: Share Session Using Server

Apr 15, 2010

Share session using server

View 3 Replies

C# - Share Session Between Two Web Sites Using .net And State Server?

Aug 9, 2010

I have two exactly the same web sites hosted in two different machines under IIS 7.5.
ASP.NET state service is running on my machine and the web.config is updated in both sites with the following code:

<sessionState mode="StateServer" stateConnectionString="tcpip=" cookieless="false" timeout="120"/>

The allow remote connection is set to 1 in registry in order for the second web site to access the state server.Both web sites have the same machine key:

<machineKey validationKey="7CB8DF6872FB6B35DECD3A8F55582350FEE1FAB9BE6B930216056C1B5BA69A4C5777B3125A42C4AECB4419D43EC12F168FD1BB887469798093C3CAA2427B2B89"[code]....

Additionally both sites are configured in IIS to have the same Identifier.What I want to do is that both these sites share the same session data for example being able to do the following:

// At web site 1:
Session["key"] = "value"[code]....

The problem is that I can't manage to accomplish this test and really can't understand what I am doing wrong.

View 2 Replies

C# - Amazon EC2 Multiple Servers Share Session State

Mar 12, 2010

I have a bunch of EC2 servers that are load balanced. Some of the servers are not sharing session, and users keep getting logged in and out. How can I make all the server share the one session, possibly even using a partitionresolver solution

public class PartitionResolver : System.Web.IPartitionResolver
private String[] partitions;
public void Initialize()
// create the partition connection string table
// web1, web2
partitions = new String[] { "" };

public String ResolvePartition(Object key)
String oHost = System.Web.HttpContext.Current.Request.Url.Host.ToLower().Trim();
if (oHost.StartsWith("10.0.0") || oHost.Equals("localhost"))
return "tcpip=";
String sid = (String)key;
// hash the incoming session ID into
// one of the available partitions
Int32 partitionID = Math.Abs(sid.GetHashCode()) % partitions.Length;
return ("tcpip=" + partitions[partitionID] + ":42424");

View 1 Replies

State Management :: Share Session Between 2 Virtual Directories

Jul 27, 2010

I have 2 different Virtual Directories on my local IIS 7.0 server. I want to do session Management in such a way that Session variable created in one Virtual Directory is easily available in another Virtual Directory. I want to achieve this using SQL Server 2005. Till now I have done the following things

1) In my web.config file I have added the following entry

<sessionState mode="SQLServer" sqlConnectionString="Data Source=;Integrated Security=False;User ID=uid;pwd=pwd" sqlCommandTimeout="30" >

2) In SQL Server I have a database called ASPState that has 2 tables ASPStateTempApplications and ASPStateTempSessions and also some Store Procedures

Now If I create Session variable called Session["ProductID"] in Virtual directory A how can I access Session["ProductID"] in Virtual directory B.

View 5 Replies

C# - Uniquely Identify Two Instances Of One Browser That Share Session State?

Mar 14, 2010

I want to ensure a user isn't editing the same form data in two different browser tabs or windows (of the same web browser instance). The intention is to stop the user from accidentally overwriting their own data as they continue through a very long form process. On the server, ongoing data input through the screens is collected into the Session.

Assume for any browser, all tabs and windows run in the same instance of it (i.e. not each in a separate process). Obviously the browser tabs and windows share the same cookies in this scenario so cookie modification seems out of the question for viable solutions. This is also the reason they are sharing the same session state.

Considering that the form is already created and this is one of the final touches, how can I use ASP.NET, hopefully easily, to oversee this "feature"?

View 5 Replies

State Management :: Unable To Make The Session State Request

Apr 21, 2010

Our Web Server rebooted due to power failure. Now ASP.Net State service would not start logging the following error on the server:

Unable to make the Session State Request to the session state server. Last known phase=Sending request to the state server

how to bring back the ASP.Net State service.

View 2 Replies

C# - Track Session Timeout When Using Stateserver?

Apr 28, 2010

Is is possible to log when a session times out when a stateserver is used to manage session data?

View 2 Replies

State Management :: Switching From InProc To StateServer Mode?

Jan 18, 2011

I have an asp.net site that's basically a giant form for users to submit weekly turkey information for their starter and finisher houses. I use session variables so the information is viewable to a "Review" page. There have been 3 instances where the users would try to submit their information but kept losing their information. As far as I know, they are not letting the page sit idle for more than 20 minutes. I tested it out myself and lost session variables after less than 10 minutes. My sessionState mode is InProc. Should I look into switching to StateServer? If so, how would I do this?


View 14 Replies

Unable To Serialize Session State

Dec 11, 2013

Getting error when trying to save structured arraylist into session Variable (see btnTS_Click below)

Code works on my desktop VS2012 devel system but not when posted to webserver we use.

Try It: [URL] ....

Public Class _Default
Inherits System.Web.UI.Page
Structure HoursData
Dim Project As String


View 9 Replies

Unable To Access Session State From Class?

Jul 2, 2010

I have a Dynamic Data application to which I have added a class for extending EDM. Everything works great, but now I am trying to set an entity property value equal to a value in session state - and its not recognizing the Session command. I'm trying to do something like this:

audit.action_by = CStr(Session("person_name"))

I think this is because I do not have the class Inheriting Page, but if I do add Inherits Page it breaks other stuff. How can I have the class include the ability to utilize sessions directly without inheriting Page?

View 2 Replies

Unable To Serialize Session State - Server Errors

Oct 14, 2010

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 state mode is "StateServer" or "SQLServer".

Once in a state where this error appears, it appears to be hit or miss whether the errors are reproducible locally. If they are, then we can usually reproduce them for a couple minutes, but not on every page hit. This usually tapers off on its own and usually has resolved itself by the time we get back in contact with the users. The Web Service has around 90-100 active connections during business hours. The only other site on this server is the staging version of this site, which gets hit very infrequently. The Session State is stored on the same SQLServer instance as the application database which is housed on a fairly large cluster of virtual machines.

Neither the Web Server or the SQLServer seemed to be taxed (either processor or memory-wise) while this is going on. The distribution of which pages are erroring seems to be comparable to the normal distribution for each page. There doesn't appear to be any pattern in terms of times of occurrence. We do have less errors on average on weekends (which correlates to normal site load), but even this appears to not be consistent. There also doesn't appear to be a correlation between the errors logged and any kind of logged performance monitor events. This includes an array of perfmon counters including:

.NET CLR Jit(w3wp)
otal # of IL Bytes Jitted
.NET CLR Jit(w3wp)IL Bytes Jitted / sec
.NET CLR Jit(w3wp)\% Time in Jit
.NET CLR Jit(w3wp)# of Methods Jitted
.NET CLR Jit(w3wp)# of IL Bytes Jitted
ASP.NET Apps v1.1.4322(__Total__)Requests Failed
ASP.NET Apps v1.1.4322(__Total__)Errors Unhandled During Execution/Sec
ASP.NET Apps v1.1.4322(__Total__)Errors Unhandled During Execution
ASP.NET Apps v1.1.4322(__Total__)Cache Total Turnover Rate
ASP.NET Apps v1.1.4322(__Total__)Errors During Preprocessing
ASP.NET Apps v1.1.4322(__Total__)Errors During Execution
ASP.NET Apps v1.1.4322(__Total__)Requests Executing
ASP.NET Apps v1.1.4322(__Total__)Requests Total
ASP.NET Apps v1.1.4322(__Total__)Errors Total
ASP.NET Apps v1.1.4322(__Total__)Sessions Abandoned
ASP.NET Apps v1.1.4322(__Total__)Errors Total/Sec
ASP.NET Apps v1.1.4322(__Total__)Anonymous Requests/Sec
ASP.NET Apps v1.1.4322(__Total__)Requests/Sec
ASP.NET Apps v1.1.4322(__Total__)Session SQL Server connections total
ASP.NET Apps v1.1.4322(__Total__)Cache Total Hit Ratio
ASP.NET v1.1.4322Requests Current
ASP.NET v1.1.4322Request Execution Time
Bytes Total/sec
PhysicalDisk(_Total)Avg. Disk Queue Length
Processor(_Total)\% Processor Time
Web Service CacheFile Cache Hits %
Web Service CacheFile Cache Misses
Web Service CacheFile Cache Hits
Web Service(_Total)Current Connections
Web Service(_Total)Post Requests/sec)

The only pattern I can see in the logs doesn't correlate to the occurrence of these errors, but is the only pattern I can see. Looking at the perfmon logs we are seeing a pattern where the "Total # of IL Bytes Jitted", "IL Bytes Jitted / sec", "% Time in Jit", "# of Methods Jitted", and "# of IL Bytes Jitted" counters for the staging site (which shouldn't be getting any traffic) doesn't pull data for a 20-50 minute period after which there is an immediate spike in "IL Bytes Jitted / sec" and a jump in "% Time in Jit" for 2-20 minute of up to 99% for the main site.

View 1 Replies

State Management :: Unable To Retain Session Variable?

Jun 17, 2010

We are setting session variables in the login page with all user details.And in all subsequent pages we check this session variable.This check is done in the page load of master page.As the number of users increased am getting error with these session variables.This session variable is returning me "nothing" when I check and the user is redirected to logout page.Interesting thing is that this is not happening always.

View 2 Replies

Sharing State Databases Between Multiple Apps

Apr 7, 2010

Is it better for a collection of ASP.NET web apps to share the same session database, or should each one have its own? If there is no significant difference, having a single database would be preferable due to easier maintenance. Background My team has an assortment of ASP.NET web apps, all written in either Monorail 1.1 or ASP.NET MVC 1.0. Each app currently uses a dedicated session state database. I'm working on adding a new site to that list, and am debating whether I should create another new session database, or just share an existing one with another app.

View 1 Replies

State Management :: Error :Session State Has Created A Session Id, But Cannot Save It?

Nov 18, 2010

I read the solutioin for this error, at the following link :http://forums.asp.net/p/1046935/1576341.aspxbut I am still not clear what exactly causes the error. I have two doubts :1. Can anyone please elaborate a bit on this issue, with any example ????2. Is there any drawback of this approach ?

View 4 Replies

What's Difference Between Normal Session State And Cookieless Session State

Feb 16, 2010

In ASP.NET, I'm a bit confused about role of cookies in session state. Whats is the difference between normal session state and cookieless session state?

View 5 Replies

Share State Between Azure Instances?

Mar 22, 2011

I want to use a global data for MVC web application running on Windows Azure (e.g. something like a list of users having new messages).

For a normal webapp, I could use some per-appdomain storage like AppDomain.SetData or just static variable. What should I use for Azure instead (cache? blob storage? queues?) and what solution would be the fastest one?

View 3 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved