ASP.NET Session State
-
Hi, I have problem with my web site, when user sign in i use the session to store username and password, but it early to expire. Sometimes 1 or 2 mns. I have put Session in web.config already Please help me
Socheat
-
Hi, I have problem with my web site, when user sign in i use the session to store username and password, but it early to expire. Sometimes 1 or 2 mns. I have put Session in web.config already Please help me
Socheat
If your session is set to the default of 20 minutes then there must be some other cause. If your session is stored as "InProc" (In Process) then it can be damaged by a number of things. The App Pool being recycled (becuase it is now in a different process). IIS being reset. You have a web garden or web farm. Anything that means that the new web request is handled somehow by a different process to the previous request. However, if you are doing this in Visual Studio and stopping and starting debugging then this is only natural and to be expected.
* Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
-
If your session is set to the default of 20 minutes then there must be some other cause. If your session is stored as "InProc" (In Process) then it can be damaged by a number of things. The App Pool being recycled (becuase it is now in a different process). IIS being reset. You have a web garden or web farm. Anything that means that the new web request is handled somehow by a different process to the previous request. However, if you are doing this in Visual Studio and stopping and starting debugging then this is only natural and to be expected.
* Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
Yes, I used "InProc" in web.config I developed in Visual Studio in my local, it work normally, but when upload it to the server it work not good because the session always expire. So anyway that can do?
Socheat
-
Yes, I used "InProc" in web.config I developed in Visual Studio in my local, it work normally, but when upload it to the server it work not good because the session always expire. So anyway that can do?
Socheat
Socheat.Net wrote:
So anyway that can do?
Just check ASP.NET process is recycling frequently? I believe it gives some entries to EventViewer when it restarts. If it is recyling frequently, you need to find why it is doing so and solve it.
Navaneeth How to use google | Ask smart questions
-
Yes, I used "InProc" in web.config I developed in Visual Studio in my local, it work normally, but when upload it to the server it work not good because the session always expire. So anyway that can do?
Socheat
Socheat.Net wrote:
So anyway that can do?
You have to find out what is causing it to expire first. This means adding some additional logging to your application (I presume you already have some logging already). To start: In your Global.asax.cs/.bv file you'll have a method that handles the Application Start event. Log when ever that is called. If you notice that it is called around the same time as you lose your session then you know that your process isn't surviving long enough. So, if your process isn't surviving very long you need to find out why. If you don't get lots of log messages in that area then you'll need to move onto the next step and log something else. It is a process of trial and error with potentially many iterations.
* Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
-
Socheat.Net wrote:
So anyway that can do?
Just check ASP.NET process is recycling frequently? I believe it gives some entries to EventViewer when it restarts. If it is recyling frequently, you need to find why it is doing so and solve it.
Navaneeth How to use google | Ask smart questions
N a v a n e e t h wrote:
I believe it gives some entries to EventViewer when it restarts
I'm not sure that it does. At least not by default. I've got a web application that recycles far too often for my liking and I only see a message that I put up when the Appliation_Start method runs to say that it has processed a certain config setting that I created.
* Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
-
N a v a n e e t h wrote:
I believe it gives some entries to EventViewer when it restarts
I'm not sure that it does. At least not by default. I've got a web application that recycles far too often for my liking and I only see a message that I put up when the Appliation_Start method runs to say that it has processed a certain config setting that I created.
* Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
Colin Angus Mackay wrote:
I'm not sure that it does. At least not by default.
Well, I was not sure. Anyway, solving this kind of problem is a pain. :)
Navaneeth How to use google | Ask smart questions
-
Colin Angus Mackay wrote:
I'm not sure that it does. At least not by default.
Well, I was not sure. Anyway, solving this kind of problem is a pain. :)
Navaneeth How to use google | Ask smart questions
N a v a n e e t h wrote:
Anyway, solving this kind of problem is a pain
Absolutely. :sigh:
* Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
-
Socheat.Net wrote:
So anyway that can do?
You have to find out what is causing it to expire first. This means adding some additional logging to your application (I presume you already have some logging already). To start: In your Global.asax.cs/.bv file you'll have a method that handles the Application Start event. Log when ever that is called. If you notice that it is called around the same time as you lose your session then you know that your process isn't surviving long enough. So, if your process isn't surviving very long you need to find out why. If you don't get lots of log messages in that area then you'll need to move onto the next step and log something else. It is a process of trial and error with potentially many iterations.
* Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
Thanks. I will try my best
Socheat
-
Thanks. I will try my best
Socheat
You can do one thing. Create a separate Application Pool For Your Web Application Only. Then test the web application. Make sure you are having only one Worker process (Not a web garden).
cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net