473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ASP.NET - Loosing Session Variables

Hello

I'm running two Webservers Using ASP.NET. both are running the same ASP.NET
Application, with

<sessionState mode="SQLServer" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=myserver;user id=myuser;password=mypw"
cookieless="false" timeout="20" />

This seems to work. But we have cases, when users report that they loose the
session. I really can't say why it is lost. But I also see when that i get
sometimes errors that session-object gets empty, when it should nearly be
impossible to be empty, so I really can't figure it out.

Question,
- IIS6 Recycle doesn't matter in that case, because the Session is in SQL
Server
- Changeing the web.config doesnt effect anything of that, right?
- I checked out in the tmpdb the ASPStateTempSessions and found out, that it
is kind of 2 Hours back of the real server time, is it using GMT?
- in the ASPStateTempApplications i have just one application, is that
correct?
- Has someone some ideas?

Thanks
Patrick
Nov 18 '05 #1
9 2073
> This seems to work. But we have cases, when users report that they loose
the
session. I really can't say why it is lost. But I also see when that i get
sometimes errors that session-object gets empty, when it should nearly be
impossible to be empty, so I really can't figure it out.
Perhaps they timed out?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Patrick" <pa********@bluemail.ch> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl... Hello

I'm running two Webservers Using ASP.NET. both are running the same ASP.NET Application, with

<sessionState mode="SQLServer" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=myserver;user id=myuser;password=mypw"
cookieless="false" timeout="20" />

This seems to work. But we have cases, when users report that they loose the session. I really can't say why it is lost. But I also see when that i get
sometimes errors that session-object gets empty, when it should nearly be
impossible to be empty, so I really can't figure it out.

Question,
- IIS6 Recycle doesn't matter in that case, because the Session is in SQL
Server
- Changeing the web.config doesnt effect anything of that, right?
- I checked out in the tmpdb the ASPStateTempSessions and found out, that it is kind of 2 Hours back of the real server time, is it using GMT?
- in the ASPStateTempApplications i have just one application, is that
correct?
- Has someone some ideas?

Thanks
Patrick

Nov 18 '05 #2
timed out? you mean the 20minutes? - i don't think so, because the 20
minutes are always updated sinde the last click i made on the webpage,
right? or are they only valid from start of the session when using SQLServer
to store it? if yes, so this is probably the problem!
"Kevin Spencer" <ks******@takempis.com> schrieb im Newsbeitrag
news:%2****************@tk2msftngp13.phx.gbl...
This seems to work. But we have cases, when users report that they loose the
session. I really can't say why it is lost. But I also see when that i get sometimes errors that session-object gets empty, when it should nearly be impossible to be empty, so I really can't figure it out.


Perhaps they timed out?

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Patrick" <pa********@bluemail.ch> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hello

I'm running two Webservers Using ASP.NET. both are running the same

ASP.NET
Application, with

<sessionState mode="SQLServer"

stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=myserver;user id=myuser;password=mypw"
cookieless="false" timeout="20" />

This seems to work. But we have cases, when users report that they loose

the
session. I really can't say why it is lost. But I also see when that i get sometimes errors that session-object gets empty, when it should nearly be impossible to be empty, so I really can't figure it out.

Question,
- IIS6 Recycle doesn't matter in that case, because the Session is in SQL Server
- Changeing the web.config doesnt effect anything of that, right?
- I checked out in the tmpdb the ASPStateTempSessions and found out,

that it
is kind of 2 Hours back of the real server time, is it using GMT?
- in the ASPStateTempApplications i have just one application, is that
correct?
- Has someone some ideas?

Thanks
Patrick


Nov 18 '05 #3
Sessions only time out after a period of no requests from the client. So, if
your "last click" was a hyperlink or other element that caused a request to
occur, the Session isn't timing out.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Patrick" <pa********@bluemail.ch> wrote in message
news:#4**************@TK2MSFTNGP11.phx.gbl...
timed out? you mean the 20minutes? - i don't think so, because the 20
minutes are always updated sinde the last click i made on the webpage,
right? or are they only valid from start of the session when using SQLServer to store it? if yes, so this is probably the problem!
"Kevin Spencer" <ks******@takempis.com> schrieb im Newsbeitrag
news:%2****************@tk2msftngp13.phx.gbl...
This seems to work. But we have cases, when users report that they loose
the
session. I really can't say why it is lost. But I also see when that i get sometimes errors that session-object gets empty, when it should nearly be impossible to be empty, so I really can't figure it out.


Perhaps they timed out?

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Patrick" <pa********@bluemail.ch> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hello

I'm running two Webservers Using ASP.NET. both are running the same

ASP.NET
Application, with

<sessionState mode="SQLServer"

stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=myserver;user
id=myuser;password=mypw" cookieless="false" timeout="20" />

This seems to work. But we have cases, when users report that they
loose the
session. I really can't say why it is lost. But I also see when that i

get sometimes errors that session-object gets empty, when it should nearly be impossible to be empty, so I really can't figure it out.

Question,
- IIS6 Recycle doesn't matter in that case, because the Session is in SQL Server
- Changeing the web.config doesnt effect anything of that, right?
- I checked out in the tmpdb the ASPStateTempSessions and found out,

that
it
is kind of 2 Hours back of the real server time, is it using GMT?
- in the ASPStateTempApplications i have just one application, is that
correct?
- Has someone some ideas?

Thanks
Patrick



Nov 18 '05 #4
Thanks Kevin, so this can't be the problem, but for beeing sure I will add a
entry to the session, when it was created, so I see the time difference
between the session started and the error..

but it really looks like the session is lost. what else can cause this when
session is on sql server?

thanks
"Kevin Spencer" <ks******@takempis.com> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP10.phx.gbl...
Sessions only time out after a period of no requests from the client. So, if your "last click" was a hyperlink or other element that caused a request to occur, the Session isn't timing out.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Patrick" <pa********@bluemail.ch> wrote in message
news:#4**************@TK2MSFTNGP11.phx.gbl...
timed out? you mean the 20minutes? - i don't think so, because the 20
minutes are always updated sinde the last click i made on the webpage,
right? or are they only valid from start of the session when using

SQLServer
to store it? if yes, so this is probably the problem!
"Kevin Spencer" <ks******@takempis.com> schrieb im Newsbeitrag
news:%2****************@tk2msftngp13.phx.gbl...
> This seems to work. But we have cases, when users report that they loose the
> session. I really can't say why it is lost. But I also see when that i
get
> sometimes errors that session-object gets empty, when it should
nearly
be
> impossible to be empty, so I really can't figure it out.

Perhaps they timed out?

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Patrick" <pa********@bluemail.ch> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
> Hello
>
> I'm running two Webservers Using ASP.NET. both are running the same
ASP.NET
> Application, with
>
> <sessionState mode="SQLServer"
stateConnectionString="tcpip=127.0.0.1:42424"
> sqlConnectionString="data source=myserver;user id=myuser;password=mypw" > cookieless="false" timeout="20" />
>
> This seems to work. But we have cases, when users report that they loose the
> session. I really can't say why it is lost. But I also see when that

i get
> sometimes errors that session-object gets empty, when it should
nearly be
> impossible to be empty, so I really can't figure it out.
>
> Question,
> - IIS6 Recycle doesn't matter in that case, because the Session is
in SQL
> Server
> - Changeing the web.config doesnt effect anything of that, right?
> - I checked out in the tmpdb the ASPStateTempSessions and found out,

that
it
> is kind of 2 Hours back of the real server time, is it using GMT?
> - in the ASPStateTempApplications i have just one application, is

that > correct?
> - Has someone some ideas?
>
> Thanks
> Patrick
>
>



Nov 18 '05 #5
Not sure, Patrick. According to the .Net SDK, if you are using SQL Server,
you have a choice of 2 scripts to run to install Session State on the SQL
Server. If you use InstallSqlState.sql, a reboot of the SQL Server will lose
all Session values. If you use InstallPersistSqlState, the Sessions can't be
lost. However, I would think that Network issues could have an impact as
well, as the SQL Server is most likely not the same machine as the web
server.

Also, are you using a Web Farm scenario? Configuration issues can cause
problems with a Web Farm.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Patrick" <pa********@bluemail.ch> wrote in message
news:uE**************@TK2MSFTNGP11.phx.gbl...
Thanks Kevin, so this can't be the problem, but for beeing sure I will add a entry to the session, when it was created, so I see the time difference
between the session started and the error..

but it really looks like the session is lost. what else can cause this when session is on sql server?

thanks
"Kevin Spencer" <ks******@takempis.com> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP10.phx.gbl...
Sessions only time out after a period of no requests from the client. So,
if
your "last click" was a hyperlink or other element that caused a request to
occur, the Session isn't timing out.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Patrick" <pa********@bluemail.ch> wrote in message
news:#4**************@TK2MSFTNGP11.phx.gbl...
timed out? you mean the 20minutes? - i don't think so, because the 20
minutes are always updated sinde the last click i made on the webpage,
right? or are they only valid from start of the session when using

SQLServer
to store it? if yes, so this is probably the problem!
"Kevin Spencer" <ks******@takempis.com> schrieb im Newsbeitrag
news:%2****************@tk2msftngp13.phx.gbl...
> > This seems to work. But we have cases, when users report that they

loose
> the
> > session. I really can't say why it is lost. But I also see when that i get
> > sometimes errors that session-object gets empty, when it should nearly be
> > impossible to be empty, so I really can't figure it out.
>
> Perhaps they timed out?
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "Patrick" <pa********@bluemail.ch> wrote in message
> news:um**************@TK2MSFTNGP11.phx.gbl...
> > Hello
> >
> > I'm running two Webservers Using ASP.NET. both are running the
same > ASP.NET
> > Application, with
> >
> > <sessionState mode="SQLServer"
> stateConnectionString="tcpip=127.0.0.1:42424"
> > sqlConnectionString="data source=myserver;user id=myuser;password=mypw"
> > cookieless="false" timeout="20" />
> >
> > This seems to work. But we have cases, when users report that they

loose
> the
> > session. I really can't say why it is lost. But I also see when that i get
> > sometimes errors that session-object gets empty, when it should nearly be
> > impossible to be empty, so I really can't figure it out.
> >
> > Question,
> > - IIS6 Recycle doesn't matter in that case, because the Session is in SQL
> > Server
> > - Changeing the web.config doesnt effect anything of that, right?
> > - I checked out in the tmpdb the ASPStateTempSessions and found
out, that
> it
> > is kind of 2 Hours back of the real server time, is it using GMT?
> > - in the ASPStateTempApplications i have just one application, is

that > > correct?
> > - Has someone some ideas?
> >
> > Thanks
> > Patrick
> >
> >
>
>



Nov 18 '05 #6
TPS
Patrick, you need to dig down into your machine.config and make the
application name that same for each server.

If you look in your sql server session tables you will see 2 session records
for each session because you have two servers servering up web pages.

email me if you want more detail.

Take the numbers out of my email address.

43************@543mac554texas.com

TPS.
"Patrick" <pa********@bluemail.ch> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hello

I'm running two Webservers Using ASP.NET. both are running the same ASP.NET Application, with

<sessionState mode="SQLServer" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=myserver;user id=myuser;password=mypw"
cookieless="false" timeout="20" />

This seems to work. But we have cases, when users report that they loose the session. I really can't say why it is lost. But I also see when that i get
sometimes errors that session-object gets empty, when it should nearly be
impossible to be empty, so I really can't figure it out.

Question,
- IIS6 Recycle doesn't matter in that case, because the Session is in SQL
Server
- Changeing the web.config doesnt effect anything of that, right?
- I checked out in the tmpdb the ASPStateTempSessions and found out, that it is kind of 2 Hours back of the real server time, is it using GMT?
- in the ASPStateTempApplications i have just one application, is that
correct?
- Has someone some ideas?

Thanks
Patrick

Nov 18 '05 #7
TPS
Patrick,
I am assuming you are using load balancing if you are using two servers in
your application correct? If so...

I steered you wrong last night with this statement:
Patrick, you need to dig down into your machine.config and make the
application name that same for each server.


If you look in your ASPState database and view the ASPTempApplications
table,
you will probably have two rows. One for each server. This is bad. Now
look
in the ASPTempSessions table and notice you probably have 2 rows for each
sessionID. Each server is holding it's own session, yet there should be
only
one session.
You need to sync the application names in the IIS metabase.
Get ahold of a copy of MetaEdit (search ms site) and make sure
this # (1751721335) is the same on all servers in this key.
LM\W3SVC\1751721335\root\

It does not have to be the number in this example, just make sure they
are the same on both of your servers.
1. Syncronize application names in the IIS metabase.
LM\W3SVC\1751721335\root\
key name: approot value = /LM/W3SVC/1751721335/Root
Make the above keys the same on all servers using metaedit.exe

2. Syncronize encryption keys across all web servers

a. Generate a key by running
E:\Source\DOTNET\CPO\HashConfigCs\bin\Debug\HashCo nfigCs.exe and pass these
args 24 64

See this article http://support.microsoft.com/?id=312906

b. Paste output from the above program into the machine.config on each
machine

<machineKey
validationKey="FED661660E09167F30CCFFF4E5DADF3E036 FD7712E7B187762FF32B918BC3
CA8FC1A751F3F7EFAD0A48AAC4DB90DDDD639E82B96632796B 416A64ABA1EF29A6F"

decryptionKey="DCB56D6EC85B79DF7DCD85F45F775B6AB01 6ABB3BE5C5E2C"
validation="SHA1"/>

Hope this helps,
TPS
Nov 18 '05 #8
Hi

Thanks for your Email. I checked my configuration, and I have the same
number for both webservers, it's different than yours, but it's the same. So
I also have only 1 entry in the ASPTempApplications Table. I also tried to
to connect to one website, then to the other, I don't loose the Session. But
what I've different is the machine.config...

here i have:

<machineKey validationKey="AutoGenerate,IsolateApps"
decryptionKey="AutoGenerate,IsolateApps" validation="SHA1"/>

should I change this to yours? Can this be the reason why sometimes sessions
are just dropped? I'ts 100% sure not the session-timeout.

I just have this problem since using the Session in the SQL Server.

Any other good ideas?
Thanks a lot
"TPS" <tp*@tps.com> schrieb im Newsbeitrag
news:et*************@TK2MSFTNGP09.phx.gbl...
Patrick,
I am assuming you are using load balancing if you are using two servers in
your application correct? If so...

I steered you wrong last night with this statement:
Patrick, you need to dig down into your machine.config and make the
application name that same for each server.

If you look in your ASPState database and view the ASPTempApplications
table,
you will probably have two rows. One for each server. This is bad. Now
look
in the ASPTempSessions table and notice you probably have 2 rows for each
sessionID. Each server is holding it's own session, yet there should be
only
one session.
You need to sync the application names in the IIS metabase.
Get ahold of a copy of MetaEdit (search ms site) and make sure
this # (1751721335) is the same on all servers in this key.
LM\W3SVC\1751721335\root\

It does not have to be the number in this example, just make sure they
are the same on both of your servers.
1. Syncronize application names in the IIS metabase.
LM\W3SVC\1751721335\root\
key name: approot value = /LM/W3SVC/1751721335/Root
Make the above keys the same on all servers using metaedit.exe

2. Syncronize encryption keys across all web servers

a. Generate a key by running
E:\Source\DOTNET\CPO\HashConfigCs\bin\Debug\HashCo nfigCs.exe and pass

these args 24 64

See this article http://support.microsoft.com/?id=312906

b. Paste output from the above program into the machine.config on each
machine

<machineKey
validationKey="FED661660E09167F30CCFFF4E5DADF3E036 FD7712E7B187762FF32B918BC3 CA8FC1A751F3F7EFAD0A48AAC4DB90DDDD639E82B96632796B 416A64ABA1EF29A6F"

decryptionKey="DCB56D6EC85B79DF7DCD85F45F775B6AB01 6ABB3BE5C5E2C"
validation="SHA1"/>

Hope this helps,
TPS

Nov 18 '05 #9
Hi

Thanks for your Email. I checked my configuration, and I have the same
number for both webservers, it's different than yours, but it's the same. So
I also have only 1 entry in the ASPTempApplications Table. I also tried to
to connect to one website, then to the other, I don't loose the Session. But
what I've different is the machine.config...

here i have:

<machineKey validationKey="AutoGenerate,IsolateApps"
decryptionKey="AutoGenerate,IsolateApps" validation="SHA1"/>

should I change this to yours? Can this be the reason why sometimes sessions
are just dropped? I'ts 100% sure not the session-timeout.

I just have this problem since using the Session in the SQL Server.

Any other good ideas?
Thanks a lot
"TPS" <tp*@tps.com> schrieb im Newsbeitrag
news:et*************@TK2MSFTNGP09.phx.gbl...
Patrick,
I am assuming you are using load balancing if you are using two servers in
your application correct? If so...

I steered you wrong last night with this statement:
Patrick, you need to dig down into your machine.config and make the
application name that same for each server.

If you look in your ASPState database and view the ASPTempApplications
table,
you will probably have two rows. One for each server. This is bad. Now
look
in the ASPTempSessions table and notice you probably have 2 rows for each
sessionID. Each server is holding it's own session, yet there should be
only
one session.
You need to sync the application names in the IIS metabase.
Get ahold of a copy of MetaEdit (search ms site) and make sure
this # (1751721335) is the same on all servers in this key.
LM\W3SVC\1751721335\root\

It does not have to be the number in this example, just make sure they
are the same on both of your servers.
1. Syncronize application names in the IIS metabase.
LM\W3SVC\1751721335\root\
key name: approot value = /LM/W3SVC/1751721335/Root
Make the above keys the same on all servers using metaedit.exe

2. Syncronize encryption keys across all web servers

a. Generate a key by running
E:\Source\DOTNET\CPO\HashConfigCs\bin\Debug\HashCo nfigCs.exe and pass

these args 24 64

See this article http://support.microsoft.com/?id=312906

b. Paste output from the above program into the machine.config on each
machine

<machineKey
validationKey="FED661660E09167F30CCFFF4E5DADF3E036 FD7712E7B187762FF32B918BC3 CA8FC1A751F3F7EFAD0A48AAC4DB90DDDD639E82B96632796B 416A64ABA1EF29A6F"

decryptionKey="DCB56D6EC85B79DF7DCD85F45F775B6AB01 6ABB3BE5C5E2C"
validation="SHA1"/>

Hope this helps,
TPS


Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Billy Jacobs | last post by:
I am having a problem with my session variable being set to Null for no apparent reason. I am declaring it like the following when the user logs in. dim objUserInfo as new clsUserInfo 'Set...
1
by: Jonk Eidersteldvr | last post by:
Hi, I am using a web application -asp, ado, C#, using CodeBehind files etc.. I am using "InProc" session state and find that session variables are loosing their values between one web form and...
8
by: Radu Colceriu | last post by:
HI, I've an asp.net app like this: login.aspx (no frame) :- save in session the user and pass -> framedoc.html :- frameset 2 content 1. menu.aspx...
2
by: Robert Berezka | last post by:
hi! I am working on a ASP.NET project. My problem with the session vaiable is: Localy on my client computer, where I develope my ASP.Net application, Everything runs fine. When I...
6
by: Lars Netzel | last post by:
This is basic Session handling but it's not working. On a Page1.aspx I have this code: ----------------------------------- If TextBox1.Text = "admin" And TextBox2.Text = "Admin01" Then ...
2
by: Aaric | last post by:
I am developing my web apps on a Win XP Pro SP2 laptop and then uploading them to a Windows Server 2003. My current project involves using session state variables to keep track of user after they...
15
by: cyndi_r2000 | last post by:
Hi Everyone: I have a web application running on .NET 2.0 under IIS 6.0 and users of this application seem to be loosing their session randomly - we havent been able to identify any pattern,...
1
by: Dabbler | last post by:
I set some strings and integers in Session but when I get to my redirected page the values are null. I'm running on localhost Windows XP Pro but using remote SQL 2005 database. Not doing...
5
by: Mirovk | last post by:
The onclick action associated to my form´s radio buttons call to a vbscript were the session values are changed, this happens correctly but with the onclick action associated to my continue button...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.