HttpContext not available in Class Library

后端 未结 3 751
忘了有多久
忘了有多久 2021-01-07 19:08

I am working on a project where I have a C# class library which needs to use the System.web.HttpContext. I\'ve done this before in another project without probl

3条回答
  •  时光说笑
    2021-01-07 19:31

    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

提交回复
热议问题