Httpcontext.current.session[strname] Object reference not set to an instance of an object

Source: Internet
Author: User

Project development is on the 4.5.1, do not know why the customer provided the server installed is 4.5, the difference is not to upgrade, and then deploy MVC when the Web. config error

<system.web>    <compilation debug="true" targetframework="  4.5.1"/>    "4.5.1"/>  </system.web>

And then did not care that the paragraph was deleted, and then the session of the piece began to error

Httpcontext.current.session[key.sessionopenid] = OpenID; The object reference was not set to an instance of the object because it was used asynchronously, so there was an error, and finally the reason was found in StackOverflow.

Https://stackoverflow.com/questions/18383923/why-is-httpcontext-current-null-after-await

It's really a sore egg.

Warning: If your project is upgraded to 4.5. Be sure to add this sentence to the webconfig.

Httpcontext.current.session[strname] Object reference not set to an instance of an object

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.