WebHeaderCollection 类
https://msdn.microsoft.com/zh-cn/library/system.net.webheadercollection(v=VS.95).aspx
/// <summary>
/// key统一小写
/// </summary>
/// <returns></returns>
public Dictionary<string, string> GetReqHeaders()
{
var request = HttpContext.Current.Request;
var headers = request.Headers;
var dict = new Dictionary<string, string>(); foreach (var key in headers.AllKeys)
{
dict.Add(key.ToLower(), headers[key]);
}
foreach (var key in new string[] { "userid", "systemtype" })
{
if (!dict.ContainsKey(key))
dict.Add(key, "");
}
return dict;
} public WebHeaderCollection GetWebHeaderCollection()
{
WebHeaderCollection myWebHeaderCollection = new WebHeaderCollection();
var headinfo = this.Headers;
List<string> passheads = new List<string>() { "cache-control", "connection", "content-length", "content-type", "method", "accept", "accept-encoding", "accept-language", "host", "accept-charset", "user-agent", "origin", "if-modified-since" };
foreach (var key in headinfo.Keys)
{
if (passheads.Contains(key))
{
continue;
}
else
{
myWebHeaderCollection.Add(key, myWebHeaderCollection[key]);
}
}
return myWebHeaderCollection;
}
WebHeaderCollection 类的更多相关文章
- WebHeaderCollection类
.net添加http报头 string[] allKeys = WebHeaderCollection.AllKeys; for (int i = 0; i < allKeys.Length; ...
- Java类的继承与多态特性-入门笔记
相信对于继承和多态的概念性我就不在怎么解释啦!不管你是.Net还是Java面向对象编程都是比不缺少一堂课~~Net如此Java亦也有同样的思想成分包含其中. 继承,多态,封装是Java面向对象的3大特 ...
- [破解版]Unity3d引擎最新稳定版本4.5.5下载(官方最新稳定版本)
来源:http://www.unitymanual.com/thread-28912-1-1.html unity4.5.5 Mac版下载地址:http://pan.baidu.com/s/1hqzi ...
- HttpHelper类
using System;using System.Collections.Generic;using System.Text;using System.Net;using System.IO;usi ...
- 一个C#的与web服务器交互的HttpClient类
using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Net ...
- [C#HttpHelper]类1.4正式版教程与升级报告
[C#HttpHelper]类1.4正式版教程与升级报告 导读 1.升级报告 2.HttpHelper1.4正式版下载 3.HttpHelper类使用方法, 4.最简单的Post与Get的写法 ...
- 完整HttpHelper类
[代码] [C#]代码 using System; using System.Collections.Generic; using System.Text; using System.Net; usi ...
- HttpHelper工具类
/// <summary> /// 类说明:HttpHelper类,用来实现Http访问,Post或者Get方式的,直接访问,带Cookie的,带证书的等方式,可以设置代理 /// 重要提 ...
- HttpWebResponse类
HttpWebResponse类的作用用于在客户端获取返回的响应的信息,还记得HttpResponse类吗?你是否在写B/S程序的时候,经常用到Response.Write()呢? HttpRespo ...
随机推荐
- DateTime , DateTime2 ,DateTimeOffset 之间的小区别
闲来无事列了个表比对一下这3兄弟之间还是有一点差距的╮(╯_╰)╭ DateTime DateTime2 DateTimeOffset 日期范围 1753-01-01到 9999-12-31 00 ...
- SQL SERVER 并发【2015.12.16】
并发控制模型 1.悲观并发控制: A.默认冲突存在,当前进程通过获取当前数据的锁阻止其他进程的访问. B.读与写之间是相互阻塞. 2.乐观并发控制: A.使用行版本控制保持数据被操作前的状态. B ...
- 五、Android学习第四天补充——Android的常用控件(转)
(转自:http://wenku.baidu.com/view/af39b3164431b90d6c85c72f.html) 五.Android学习第四天补充——Android的常用控件 熟悉常用的A ...
- 虚拟机centos6.5 --开放端口
系统:centos6.5 1.查看端口开放情况 /etc/init.d/iptables status 2.开启端口 /sbin/iptables -I INPUT -p tcp --dport -j ...
- 基于.net开发chrome核心浏览器【六】
写在前面: 距离发这个系列的上一篇文章已经过去两个多月了 因为工作上不涉及这一部分的内容,兼且琐事缠身,一直无力动笔写这个系列的第六篇文章 然而,有很多朋友都关注这个系列,希望我能再写写. 写文章有人 ...
- [转]simple sample to create and use widget for nopcommerce
本文转自:http://badpaybad.info/simple-sample-to-create-and-use-widget-for-nopcommerce Here is very simpl ...
- REST架构
网络上的所有事物都被抽象为资源(resource): 每个资源对应一个唯一的资源标识符(resource identifier): 通过通用的连接器接口(generic connector inter ...
- SQL——查询考试
一. 设有一数据库,包括四个表:学生表(Student).课程表(Course).成绩表(Score)以及教师信息表(Teacher).四个表的结构分别如表1-1的表(一)~表( ...
- python pip install mysql-connector-python
sudo pip install mysql-connector-python 报错信息:Collecting mysql-connector-python Could not find a vers ...
- UIButton(改变Title和image位置)
UIButton *btn = [[UIButton alloc] init]; [btn setFrame:frame]; [btn setTitleColor:titleColor forStat ...