By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,914 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,914 IT Pros & Developers. It's quick & easy.

ASP.NET - Loosing Session Variables

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
> 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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.