简体   繁体   English

无法识别HttpPostedFileBase,但可以识别“使用System.Web”

[英]HttpPostedFileBase is not recognized, but “using System.Web” is

I'm trying to define a function which accepts as a parameter an object of type System.Web.HttpPostedFileBase . 我正在尝试定义一个函数,该函数接受类型为System.Web.HttpPostedFileBase的对象作为参数。

At the top of my class I included using System.Web; 在我的课堂顶部,我using System.Web; and the compiler is not too upset with that using statement. 并且编译器不会对using语句感到不满。 (It claims the statement is not necessary, but it is not throwing an error.) (它声明该语句不是必需的,但它不会引发错误。)

However, the compiler gives the following error when I define a parameter of type 'HttpPostedFileBase': The type or namespace name could not be found (are you missing a using directive or an assembly reference?) 但是,当我定义类型为'HttpPostedFileBase'的参数时,编译器会出现以下错误:找不到类型或名称空间名称(是否缺少using指令或程序集引用?)

Why is the compiler throwing this error? 为什么编译器会抛出此错误? I included the necessary using directive and assembly reference, no? 我包括了必要的using指令和程序集引用,不是吗?

You need to add a reference to System.Web from the Solution Explorer side panel. 您需要从解决方案资源管理器侧面板添加对System.Web的引用。 Simply adding a using statement will not add the reference. 仅添加using语句将不会添加引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM