我使用MVC .NET与CSLA分布式环境和我可以参考HttpPostedFileBase从我的网页层中的一个(例如Website.MVC),但我的不能参考HttpPostedFileBase从一个单独的层(让称之为OtherLayer.Web)。

这是什么,我需要做的,能够调用HttpPostedFileBase任何想法? 我能够使用HttpPostedFile在两层 - 我应该只使用这个代替

的组件的引用基本上是相同的 - 在Website.MVC我有:

namespace Website.Mvc.Controllers
{
  using System;
  using System.Collections;
  using System.Collections.Generic;
  using System.Web.Mvc;
  using System.Web;
  using System.IO;
  using PetOrganizer.Mvc.Helpers;
  using TrupanionPetInsurance.Web;

而在我的其他层我有:

namespace OtherLayer.Web
{
  using System;
  using System.Collections;
  using System.Collections.Generic;
  using System.Collections.Specialized;
  using System.Data;
  using System.Data.SqlClient;
  using System.IO;
  using System.Net.Mail;
  using System.Text;
  using System.Text.RegularExpressions; 
  using System.Web;
  using System.Web.Mvc;
  using System.Web.Security;
  using System.Xml;
  using System.Xml.Serialization;
  using Csla;
  using iTextSharp.text;
  using iTextSharp.text.pdf;
  using TruDat.BusinessLayer;
  using TruDat.BusinessLayer.Billing;
  using TruDat.BusinessLayer.Data;
  using TruDat.BusinessLayer.Utility;
  using TrupanionPetInsurance.Web.EmailTemplateParser;
  using TruDat.BusinessLayer.DataServices;

其他提示

  

请确保您的项目引用System.Web.Abstractions组件,其包含HttpPostedFileBase类型。

感谢,安德鲁野兔,该诀窍,但我认为,从.NET 4.0等,System.Web.Abstractions已被弃用,你应该添加引用,而不是对System.Web程序。

在我的情况下,这是最终的解决办法,在这之后

using System.Web;

工作,并且因此,HttpPostedFileBase被确认。

感谢。

scroll top