Project conversion from vs2008 to vs2010 or open the page design all server controls appear
The session status can be used only when enablesessionstate is set to true in the configuration file or page command. Make sure thatProgramThe configured \ section contains the system. Web. sessionstatemod or custom session Status Module.
The first time I encountered this error, I started to read a lot from Baidu and Google on the Internet.ArticleAll of them are modifying web. config (self-perception is not a configuration file error). All my pages inherit a class of BLL.
Bll references system. Web (. NET Framework 2.0I thought it was an error here. So I changed all the 4.0 DLL files to 2.0. I wonder why, and I am prompted that the reference is successful to check whether the property is.
The reason why I found it again isProtected override void oninit (eventargs E) is fine if override is removed.
Public class personal_pagebase: system. Web. UI. Page
{
Protected override void oninit (eventargs E)
{
If (system. Web. httpcontext. Current! = NULL)
{
System. Web. httpcontext. Current. session ["comanyname"] = NULL;
If (system. Web. httpcontext. Current. session ["username"] = NULL |
System. Web. httpcontext. Current. session ["username"]. tostring () = "")
{
System. Web. httpcontext. Current. response. Redirect ("/personal/login. aspx ");
Return;
}
Base. oninit (E );
}
}
In addition, there is no problem.