Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have faced with an uncommon situation of session problem in asp.net application.

First, page was authenticated and create some session, it seem to be that server not responses to create them due to page command. so page could not redirect to destination page. This will be occurred just sometime randomly.

Second, if I luckily able to pass logging in to admin page (creating session successful), session frequently lost unusually as it should be.

I've try to search and found many topics discussing that the cause was IIS apppool restarting due to an antivirus scanning. but even I turn off antivirus protection, it still happens.
where should I aim to fix? Any body can help?

please.....
Posted
Updated 20-Oct-13 20:53pm
v2
Comments
Nandakishore G N 21-Oct-13 2:56am    
have you handled session and timeout in web.config. If not add it and try
jack_th 22-Oct-13 0:46am    
I've already try and if i put it to web.config, session.abandon() command would not work.
Nandakishore G N 22-Oct-13 1:01am    
Can you paste the code written in web.config. Are you trying to say, that session is not abandoned even after Session.Abandon() is executed and even after session is initialized you are not able to get logged in right?
then paste the code what have you done till now?
jack_th 22-Oct-13 3:42am    
Excuse me! please apologize for my fault. I've put sessionstate mode="InProc" cookieless="false" timeout="240"
in web.config and it works without that symptom anymore now. But I exactly got that strange session yesterday. Let me check for what cause of that first, because i forget. Then I will come back to tell you what I'd tried to change my web.config in order to get that strange session.
Nandakishore G N 22-Oct-13 5:00am    
if the problem is solved change the status to solved. So that this will help others.

-- Nanda Kishor

Re-install OS is the way to solve this.
 
Share this answer
 
v2
It sounds like you're using an in process session state in a web gardening environment.

When you publish your website to a server, it runs within an application pool. This application pool will have multiple worker processes. Each worker process is ignorant of each of the other worker processes.

So if you're using an in process session state (Or assigning state data to static variables) you're not guaranteed/are unlikely to get the same process with a subsequence request. The next request will have a worker process for which none of the authentication values have been set.

You need to switch to an out of process session state. This means each of the worker processes has access to the same session data. So it doesn't matter which worker process serves the subsequent request.

Read the following article which covers the different state services. I'd suggest using the "StateServer" mode.

ASP.NET Session State Overview[^]

You can easily test this by tuning your application pool to use just worker process. Although I wouldn't suggest this as a solution for a production environment.
 
Share this answer
 
Comments
jack_th 22-Oct-13 4:16am    
I didn't assign session value to any static variables. More explains, are all apps in local IIS work fine. Session state has no strange symptom as being in online server. VICK, on the above comment has said, that may caused from OS, make me get though of it. How do you think for that? I may need to try re-install or not? Need comments.
Stephen Hewison 22-Oct-13 5:06am    
Look at the application pool configuration for your local IIS and for your live server. Check for differences between the configuration.
jack_th 23-Oct-13 0:30am    
They are the same at all. Tomorrow, I will try re-install OS. Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900