Tag: httppostedfile

从会话中获取文件时出现“无法访问已关闭的文件”错误消息

我有一个asp.net FileUpload控件。 我可以成功上传文件到会话中的存储,但是当我想要获取它的输入流(我在HttpPosterFile中存储文件)时我收到错误 无法访问已关闭的文件 tr.PostedFile //<== HttpPostedFile; byte[] byteArray = null; using (var binaryReader = new BinaryReader(tr.PostedFile.InputStream)) { byteArray = binaryReader.ReadBytes(tr.PostedFile.ContentLength); }

在C#中获取HttpPostedFile的字符串内容的最短方法是什么?

我有一个HttpPostedFile对象,只需要提取已发布文件的内容。 我找到了这个链接,但这是一个很长的过程,只是获取内容的字符串。 有没有更短的方式? (最好是一行指令。)

C# – 我无法引用HttpPostedFileBase

我在CSLA的分布式环境中使用MVC .NET,我可以从我的一个Web层(例如Website.MVC)引用HttpPostedFileBase,但我不能从单独的层引用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 […]