资源简介
WCF 是微软力推的通讯框架,它能够以 ASP.NET WebService 的方式实现 RESTful 方式的服务。但是缺陷是目前的版本不支持对 HTTP multipart 格式的自动解析。而不像传统的 ASP.NET WebService 可以自动解析 multipart 中的多媒体数据,并通过访问 Context.Request.Form["name"] 和 Context.Request.Files["name"] 方便地访问。
这份代码在 HttpMultipartFormDataParser (https://github.com/Vodurden/Http-Multipart-Data-Parser) 的基础上,解决了中文乱码的问题。希望给和我一样曾经被这个问题困扰的朋友一些帮助。
关于代码的使用方式,请参见 Vodurden 在 GitHub 上的说明。
代码片段和文件信息
// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) 2013 Jake Woods
//
// Permission is hereby granted free of charge to any person obtaining a copy of this software
// and associated documentation files (the “Software“) to deal in the Software without restriction
// including without limitation the rights to use copy modify merge publish distribute
// sublicense and/or sell copies of the Software and to permit persons to whom the Software
// is furnished to do so subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR IMPLIED
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM DAMAGES OR OTHER LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE
// ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Jake Woods
//
// Provides character based and byte based stream-like read operations over multiple
// streams and provides methods to add data to the front of the buffer.
//
// --------------------------------------------------------------------------------------------------------------------
namespace Wenhe.Foundation.Web.HttpMultipart
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
///
/// Provides character based and byte based stream-like read operations over multiple
/// streams and provides methods to add data to the front of the buffer.
///
internal class BinaryStreamStack
{
#region Fields
///
/// Holds the streams to read from the stream on the top of the
/// stack will be read first.
///
private readonly Stack streams = new Stack();
#endregion
#region Constructors and Destructors
///
/// Initializes a new instance of the class with the default
/// encoding of UTF8.
///
public BinaryStreamStack()
: this(Encoding.UTF8)
{
}
///
/// Initializes a new instance of the class.
///
///
/// The encoding to use for character based operations.
///
public BinaryStreamSt
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 14578 2013-02-18 22:55 BinaryStreamStack.cs
文件 4209 2013-02-18 14:10 FilePart.cs
文件 2272 2013-02-18 14:10 MultipartParseException.cs
文件 30721 2013-02-18 22:57 MultipartParser.cs
文件 2776 2013-02-18 14:10 ParameterPart.cs
文件 13199 2013-02-18 21:22 RebufferableBinaryReader.cs
文件 4834 2013-02-18 14:10 SubsequenceFinder.cs
相关资源
- c#下post multipart/form-data和JSON
- 使用C#开发的基于WCF和PNRP的P2P文件共
- c#实现HttpClient拼接multipart/form-data形式
- WCF双工通信代码(C#)
- WCF大文件分段上传winform
- C#网络应用编程第三版马骏主编上机练
- WPF动画界面以及WCF通讯框架实现即时
- Multipart解析类库源码(HttpMultipart)
- 猜数小游戏WCF网络编程技术(附服务
- C# WCF简单测试
- WcfRestFull 开发模式
- wcf restful简单实现代码
- 构建WCF面向服务的应用程序系列课程
- 1252056375_ddvip_2352 C#下基于WCF的聊天程
- CSharp_WCF C# WCF的精简版本
- C# WCF 推送数据SOCKET并发完成端口完整
- WCF和TCP消息通信练习
- C#网络应用编程实验 WCF和TCP消息通信
- C#网络应用编程实验 WCF和HTTP文件传输
- 基于C#实现onvif协议之云台控制
- c#wcf消息通信(含服务端以及客户端)
- WCF四种常用应用场景
- 基于EF+WCF的通用三层架构 含解析
- Jquery跨域调用wcf(返回Jsonp格式) 附
- C# 通过x509证书 调用WCF的
- c# 大文件 断点续传 上传 (WCF版本)
- WCF 权限验证
- wcf 通过header 验证用户名密码源码(无
- wcf 通过修改header 验证访问权限的两种
- wcf 实现大文件上传(有进度条)
评论
共有 条评论