Last post Jan 05, 2016 06:02 AM by Candice Zhou
Jan 04, 2016 10:46 AM|T.Y. CJ|LINK
When I run the project in my Visual Studio with no problem. But when I build the projects in release mode and publish to the server, The following error always occurs.
The code which throw error was:
Here is some findings:
It's only happen when the optimize code option is checked in the project property page.
HttpContext.Current.Session is null at the moment.
If there has no object assign into Session, everything work is fine.
Any clue for why the HttpContext.Current.Session will become null? but the HttpContext.Current.Items is still available.
Any hints to solve the problem?
Jan 05, 2016 06:02 AM|Candice Zhou|LINK
Hi T.Y. CJ,
Welcome to ASP.NET Forums!
It's working on your local machine so you don't have stateserver or sqlserver in your config file.
To me it seems to be like session state is disabled in your webconfig on the webserver where you are deploying.
Check the difference in setting for session on your local machine and deployment server.