HttpContext not available in Class Library

你说的曾经没有我的故事 提交于 2019-12-01 02:10:47

This means that either you are using a Client Profile as the Target Framework or the reference to System.Web was not added correctly.

Despite your comment that you've added reference to System.Web to the project it is still most likely reason of what you are seeing.

The classes you see are coming from System.Dll, not System.Web.Dll.

Just to add some input incase someone else gets hung up on this. If you are in a Unit test project or a Class Library that links back to an MVC project, you may have references to System.Web.Mvc. This DOES NOT INCLUDE System.Web. You must add both if you need something Mvc specific (like a SelectList) AND HttpContext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!