Asp - Losing Session Variables - What Exception Might Cause Sessions To Be Lost

Oct 1, 2010

I have health monitoring enabled on a production system (asp.net webforms .net 4) and I see that there's a lot of errors being sent to me indicating that a session variable has been lost.(I am trying to attach something out of session state to a entity framework data context and get a "Value cannot be null, parameter n ame entity" error). So somehow the session variable now contains null and not an object. Interestingly we have the same application deployed on two separate servers - one DMZ server for external users and one internal server for internal users. Both of these applications on two different servers seem to have the same problem.

Health Monitoring is also monitoring lifetime events and I can see from this that we do not have something like IIS recycling, config changes, changes to bin folder, recompilations etc, occuring. I've read this page: [URL] I can confirm that it's not a Response.Redirect problem because that's not happening - this is an online application form - it puts an object in session state on page_load and there's a multiview - when "next" is pressed, the object comes out of session state, is attached to the data context, changes are made from the web form and the datacontext updated. So there's no response.redirect happening.

I can also confirm the details in "Update 1" and "Update 2" from that link are not relevant to me - there is only 1 worker process running in the application pool and the server name or web address do not contain underscores. I also persued the possibility of session timeouts occuring but they should be handled by other code which is running to detect session timeouts (see: [URL]) which I have tested over and over - Part of the problem is I just cannot reproduce this error myself.......................

View 1 Replies


Similar Messages:

VS 2010 Sessions Variables Getting Lost?

Jan 28, 2012

This is my page code

Code:
Protected Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
Dim blnLogin As Boolean
blnLogin = Login(txtUserLogin.Text, txtPassword.Text)
If blnLogin = True Then

[Code] .....

So after the user presses the Login button there should be 3 variables stored in a session, this works (checked using trace='true')

Session State
Session KeyTypeValue
LoggedInSystem.String
LoggedInUserSystem.StringUser
LoggedInIDSystem.Int322

That's fine. Now I click on the AddToWall button to check if I can get the LoggedInID, it shows an empty messagebox.

In the trace there are no Sessions keys left.How can I make it keep the keys after postback/after clicking on buttons?

Note: When calling GetFriends(Session("LoggedInUser")) in the same sub as the Login button the variable does get passed to the class with sub GetFriends()

Here's my web.config

Code:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<sessionState timeout="30" />
</system.web>
</configuration>

View 3 Replies

About Session Variables Losing Its Values Before Time Out?

Jun 14, 2010

I've got some ASP pages where the session variable values get blown away BEFORE the session times out. I can't understand it. For example: if a user logs into my ASP app using his password which is stored in a session variable, it will be fully accessible for a few minutes and then all of a sudden.....Wham session variable with password value is gone. And the session timeout is far from expired. The session variable is not being touched in any way after it gets initialized with a value.

View 3 Replies

State Management :: Certain Users Losing Certain Session Variables?

Mar 14, 2011

There are a couple of user's experiences session variable loss after they've clicked a confirm button and their information is email via a relay hosting server. Below, I commented exactly where the session variables get lost.

What could be causing the session variable loss? So far, this only happens to a few users.

Part of the email that gets sent out:

[Code]....

Web config file:

[Code]....

View 4 Replies

How To Prevent Session Variables Getting Lost

May 7, 2015

i'm using session variables for send variables between aspx page and it works fine ...but after some time of inctivity(user) in the page the sessions is los...how can i resolve this issue ? this is my code below how to send session :

protected void Lst_Interv(object sender, EventArgs e)
{
Session["Id"] = gdMedical.SelectedRow.Cells[0].Text.Trim();
Session["Service"] = gdMedical.SelectedRow.Cells[6].Text.Trim();
Session["Nom"] = gdMedical.SelectedRow.Cells[2].Text.Trim();
string pageurl = "LstIntervention.aspx";
Response.Write("<script> window.open('" + pageurl + "','_blank'); </script>");
}

View 1 Replies

Session Variables Get Lost On Browser Close

May 18, 2010

I'm creating a site. Below is my authentication tag and session tag in web.config

<authentication mode="Forms">
<forms protection="All" loginUrl="Pages/Log In/Login.aspx" name=".ASPXFORMSAUTH" cookieless="UseCookies" requireSSL="false"
defaultUrl="Pages/Common/Default.aspx" enableCrossAppRedirects="false" slidingExpiration="true" timeout="30"path="/">
</forms>
</authentication>
<sessionState mode="InProc" timeout="30" cookieless="false" cookieName=".ASPSession"/>
And I have a custom Membership Providor....
<membership defaultProvider="SqlMemberShipProvider" userIsOnlineTimeWindow="15" hashAlgorithmType="">
<providers>
<clear/>
<add
name="SqlMemberShipProvider"
type="RoalManagement.SqlMemberShipProvider"
connectionStringName="SqlServices"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
writeExceptionsToEventLog="true"
applicationName="OnlineOnTheWeb"
minRequiredPasswordLength="6"
passwordStrengthRegularExpression="^.*(?=.{6,50})(?=.*[a-z])(?=.*[A-Z])(?=.*[dW]).*$"
maxInvalidPasswordAttempts="3"
requiresUniqueEmail="true"
/>
</providers>
</membership>

Now in login page after firsttime login i set some session data... like
protected void Login_LoggedIn(object sender, EventArgs e)
{
//.....
Session["EMPLOYEELOGGEDIN"] = "Y";
//.....
}

Now say i close the browser... and next time when i open the site it takes me directly to the default page [Login_LoggedIn is not called accordingly]... because i'm already logged in for 30 mins acc. to configuration. but as my session id gets changed i can't access Session["EMPLOYEELOGGEDIN"] from any page in this time. It always returns null. But how do i get back the previous session for that person?

View 7 Replies

Session Variables Lost On Postback Using AJAX?

Jun 7, 2010

I'm evaluating using Ajax in a new project and so I've developed a simple web page to test a few things, however even the simplest task seems to cause my session to be cleared. I am using VS2008 with .Net 3.5 SP1 and the page is in my existing solution which has several custom handlers and modules in the web.config. Below is the code I'm using, it's a simple test which puts a variable into the session then on the buttons postback tries to get the same variable, however it always fails as the session is blank.

The Default.aspx code snippet
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" /> [code]....

View 1 Replies

Web Forms :: Session Variables Value Lost On Page Refresh?

Jul 27, 2010

I am developing an application using Visual Studio 2010 and SQLServer 2008. My application has two pages and the first page contains a GridView with all the records "User Administration" and when user click on any Username (template field ->linkbutton) I read the USERID like this.

Session["UserID"] = e.commandArgument;
Response.Redirect("UserOperations.aspx");

which takes it to the Data Entry page where user updates the information and save the data.

The problem i am facing is that when I hit the browser REFRESH button couple of times the session variables looses the value which is trouble for me as I am using Session Variables for different purposes.

View 10 Replies

State Management :: Session Variables Value Lost Between Pages?

Nov 23, 2010

I am using Session ID Manager in all the pages of the website, but I am losing session variables in between the pages. what should I do to save the values of session variables.
Anoop

View 5 Replies

State Management :: Session Variables Lost In IFrame

Dec 13, 2010

I have session variable that is created in EditPlaylist.aspx. Edit.aspx is loading EditPlaylist.aspx in an iframe.

[Code]....

View 5 Replies

State Management :: Session Data Getting Lost For Few Variables

Apr 19, 2010

I am using Windows xp/ .net 2.0 / vs 2005 for development environment. My session data (not all session data) are getting lost when I try to navigate between pages through window.open but the same is working perfectly in proc mode but in state server / sql server mode I am facing the problem.

View 9 Replies

State Management :: Session State Variables Getting Lost?

Jun 28, 2010

I am working on an asp.net website using C#. The site deals with orders and therefore order lines. I would like to store the order in memory whilst it is being populated (with order lines) and once it gets submitted write it to a database.

The above logic has been implemented, but sometimes when accessing session state or storing a variable in it information gets lost. Take note that the web server is running a dual-core processor. I am also using the in proc session state server.

I tried changing over to using the out proc session state server (asp.net state service), but it requires serialization. Since the order and orderlines are actually linq to sql classes, the entitysets and entityref's fail to serialize.

Does anyone know the reason why session state loses information occasionally and possibly how to eliminate the problem?

View 4 Replies

Losing Sessions When Running In StateServer Mode?

Apr 23, 2010

I have checked the servers (Win Server 2003) application event logs for the following problem [URL] which doesn't show up. It just appears that sessions drop randomly for random users

It's a single server setup, no web farms and no load balancing

Even though the issue I point to above doesn't occur in the logs, is it worth increasing the stateNetworkTimeout attribute anyway? The configuration at the moment is simply

<sessionState mode="StateServer" cookieless="false" stateConnectionString="tcpip=localhost:42424" timeout="60"/>

UPDATES:

Using FormsAuth and the Timeout is set to 60

IIS6 Settings
Recycle worker processes (in minutes) = 120
Recycle worker processes (number of requests) = 35000
Recycle worker processes at the following times = Unchecked
Maximum virtual memory = Unchecked
Maximum used memory = Unchecked
Shutdown worker processes after being idle = 90
Limit the kernel request queue = 1500
Everthing else = Unchecked

View 2 Replies

Is It Possible To Recycle IIS Application Pools Without Losing User Sessions

Nov 25, 2010

We're currently deploying code to live pretty reguarly at the moment, but the down side is destroying user session data.

Is there a way of being able to recycle IIS without loosing session data, or is persisiting session state in SQL server or alike the only way?

View 2 Replies

VS 2005 Lost Sessions After 30 Minutes?

Mar 24, 2010

I have an application using login-controls.

I have this code in my webconfig:

<authentication mode="Forms" >
<forms loginUrl="default.aspx" protection="All" defaultUrl="index.aspx" timeout="100000"></forms>
</authentication>

My problem is:

If I do not activate my application for 30 minutes (my customers wants to be online all day without logging out) my session for user login is lost. How can I automatically refresh my sessions if there has been no activity for e.g. 10 minutes? It's a sort of keep-alive that I want. I thought the problem was sloved when I set the timeout to 100000 but it doesn't help

Note. My application works with the remember me function but it losses its sessions after 30 minutes.

View 8 Replies

Sessions Lost When The Page Is Reloaded (ispostback = False)?

Feb 27, 2010

I have an asp.net page that sets a few session variables. On my development machine (localhost), I do a postback and the session values are still populated.

When I Reload the page by clicking on the url bar and pressing enter the session variables are still there.

However when i deploy this page to a webserver, the page still retains the session values when doing a postback, but as soon as i click the url and press enter the session values are lost (where the ispostback = false)

But when i press the refresh button the session variables are present (but i do get a popup warning me that the page data needs to be resent!)

i am running IE 7, and the webserver is iis6 what am i doing wrong?!

View 2 Replies

State Management :: Sessions Consistently Lost- Until Repeat Visits

Apr 23, 2010

I have a session state that myself and others on my team have been bashing our heads against the wall for the past week. We have tracked it down to the following:

1) Frame page containing content pages creates a session

2) Content page creates a session, stores data in the session

3) User changes drop down list with SelectedIndexChanged autopost back and displayed fields are changed using an UpdatePanel. A new session is created, data stored in the prev. session is lost
4) User posts back, no session is created this time, however the post back fails because the session from step 2 is lost.

Now, a user closes the page, comes back, and it actually starts to work:

1) Frame page containing content page opens (no new session)

2) Content page loads data, stores in session (no new session)

3) User changes drop down list with SelectedIndexChanged auto postback and displayed fields are changed using an UpdatePanel. Sesson NOT lost

4) User posts back form, success

ASP.NET on the first visit to the site insists on creating 3 sessions, we log it in Session_Start. I can't think of any reason this should happen. I've been told the frame will always be on a seperate session; thats fine, its only being used to setup scrolling
within a frame in Dynamics CRM. The biggest question is why when we insert data into the session in step #2, it is discarded in step #3.... but only during the first visit to the page!

I've never seen this session behavior before; we don't have any session abandonments in our code, and we never clear session objects, so there shouldn't be any reason for the session to be lost.

View 2 Replies

Collect 2 Variables From One Hyperlink, And Use Those Variables In The Page_load To Set As Session?

Aug 8, 2010

i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables

such :

<a href="javascript:;" onclick="wsChangeColor('mainData', '#FF0000','#FFE4E1');return false;" title="Change color" id="red">1</a>

i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?

View 1 Replies

State Management :: Session Gets Lost When Set Session Response.cookie

Jan 25, 2011

I need to make my asp.net session cookie as secure but whenever i check user authentication and after that i am trying to set cookie to true then my session lost my user information and so it always redirect login page. I am settings user to HttpContext.Current.Session["user"] and check every time, is user is valid and if valid then move ahead. but before that i make my asp.net session cookie as true.

[Code]....

but after that i observe that somehow "Session_Start" event gets called.

View 1 Replies

C# - Losing The Session After The Postback?

Sep 1, 2010

I have been using session variables in my asp.net application for passing the next property:

[DefaultValue(true)]
public bool IsModificationMode
{
get
{
return (bool)Session["ModificationMode"];
}
set { Session["ModificationMode"] = value; }
}

In the PageLoad, I set it's value.

Now after the Postback, I am losing it's value having a a NullReferenceException

View 4 Replies

State Management :: Session And Session Variables Not Stable In Development Server?

Oct 11, 2010

I use some session variables to get the job done(shopping cart, etc) but it is not stable..manytimes I get no items in session object and other times(refreshing the page) I get missing data...I downloaded the entire site code to my local pc and debugged it and run it succesfully without any session data missing...When I run it in the server, I get bad session again: no products in shopping cart or products with missing quantities...

The same website runs smoothly in our production server too....The problem is with our development server...

View 2 Replies

State Management :: Session Variables And Tabs / Is There A Way To Reset The Session Variable

Nov 11, 2010

I have some code in my page load event where I just want to fire once when the user opens the Browser. The only issue is if you open a new tab with the same website the session variable does not reset. Is there a way to reset the session variable when you open a new tab or do you have to take the whole web browser down for it to clear the session variable.

In Global Page:

[code]....

View 2 Replies

How To Save Web Config Without Losing Session

Jun 29, 2010

I thought about saving all sessions variables to hiddens and then resaving those values back into session after I changed the web config..but there has GOT to be another way.

View 1 Replies

IIS InProc Session Variables Randomly Not Written To Session

Nov 12, 2010

There are reams of info out there about things causing InProc session to drop session objects, but that's not what's happening here. We're missing individual variables within stable InProc session objects, and are not sure whether they're not being written or being lost after a successful write. I've confirmed with WinDBG that the sessions are live and contain some, but not all, of the data written to them.

Guid g = System.Guid.NewGuid();
this.Context.Session.Add(g.ToString(), result.ImageData);
output.Write("<img src="display.aspx?id=" + g.ToString() + "">");

This code is pretty straightforward, and it works flawlessly in Test. In Production, under heavy load, though, it fails ~1% of the time. If Mr Smith visits the site and attempts to display 4 pieces of image data, 2 of them might be saved in his session and two of them be lost. The InProc session object for Mr. Smith exists. The traffic logs show he clicked 4 times, each with a different id param. But there are only 2 guids in his InProc session object, instead of 4. The 2 session objects we did capture do correspond to 2 of the id's shown in the traffic log (his 1st and 3rd clicks.) The traffic logs for his 2nd and 4th clicks, though, show a guid id that's not in his InProc session object.

Lines 1&3 of the above code obviously worked for those 2nd and 4th clicks, or he'd not have had the id in the URI for him to click. Line 2, however seems to have failed silently in some way. If any exception had been thrown, I'd expect we'd not ever have arrived at line 3. I can't see any way for the user to receive the guid id, but the session to fail to have it. The other possibility is line 2 worked successfully, but the variable later disappeared, how I cannot even imagine.

Details:
ASP.NET v3.5
IIS 6
No Web Gardening

We're running a web farm, but users constantly return to the same server. I'm researching now whether there's any way users might be slipping off to the other server.

View 2 Replies

Can Use SQL Server Session State With Sessions That Contain DataTables

Feb 2, 2011

I have inherited an ASP.NET 3.5 application that relies heavily on sessions and storing DataTables within them (I know - bad, bad, bad). The application pool on the remote shared hosting service indicated that memory is at full capacity and as a result customers are losing their shopping carts because of dropped sessions.

Ultimately the goal is to rewrite this code, but for the time being I would like to stabilize the site the best I can. The host has recommended I use SQL Server Session State instead of in-proc. I have no experience with this, so I'm hoping it's as simple as running the .sql against the database to configure SQL Server and updating the web.config.

View 1 Replies







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