The session status can be used only when enablesessionstate is set to true in the configuration file or page command. Make sure that system. Web. sessionsta is included in the \ section of the application configuration.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.