MVC 缓存
MVC 缓存
http://blog.zhaojie.me/2009/09/aspnet-mvc-fragment-cache-1.html
redis
http://www.cnblogs.com/wolf-sun/p/5404593.html
Exchange
https://msdn.microsoft.com/en-us/library/dn567668.aspx
public static void GetMailMessage(string userName, string passWord, string domain, string url)
{
ServicePointManager.ServerCertificateValidationCallback =
delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{ return true; };
//创建Exchange服务绑定对象
ExchangeServiceBinding exchangeServer = new ExchangeServiceBinding();
//创建安全身份凭证
ICredentials creds = new NetworkCredential(userName, passWord, domain);
//建立信任连接
exchangeServer.Credentials = creds;
exchangeServer.Url = url;
//定义邮件的收件箱
DistinguishedFolderIdType[] folderIDArray = new DistinguishedFolderIdType[1];
folderIDArray[0] = new DistinguishedFolderIdType();
folderIDArray[0].Id = DistinguishedFolderIdNameType.inbox; //读取inbox文件夹下所有邮件,不包括子文件夹
//folderIDArray[0].Id = DistinguishedFolderIdNameType.tasks;//读取Task文件夹下的所有任务,不包括子文件夹
//设置要读取所需满足的条件
PathToUnindexedFieldType ptuftDisplayName = new PathToUnindexedFieldType();
ptuftDisplayName.FieldURI = UnindexedFieldURIType.folderDisplayName;
PathToExtendedFieldType pteftComment = new PathToExtendedFieldType();
pteftComment.PropertyTag = "0x3004";
pteftComment.PropertyType = MapiPropertyTypeType.String;
GetFolderType myfoldertype = new GetFolderType();
myfoldertype.FolderIds = folderIDArray;
myfoldertype.FolderShape = new FolderResponseShapeType();
myfoldertype.FolderShape.BaseShape = DefaultShapeNamesType.IdOnly;
myfoldertype.FolderShape.AdditionalProperties = new BasePathToElementType[2];
myfoldertype.FolderShape.AdditionalProperties[0] = ptuftDisplayName;
myfoldertype.FolderShape.AdditionalProperties[1] = pteftComment;
//获取Exchange邮件系统中指定类型文件夹信息
GetFolderResponseType myFolder = exchangeServer.GetFolder(myfoldertype);
FolderInfoResponseMessageType firmtInbox =
(FolderInfoResponseMessageType)myFolder.ResponseMessages.Items[0];
PathToUnindexedFieldType ptuftSubject = new PathToUnindexedFieldType();
ptuftSubject.FieldURI = UnindexedFieldURIType.itemSubject;
PathToUnindexedFieldType ptuftBody = new PathToUnindexedFieldType();
ptuftBody.FieldURI = UnindexedFieldURIType.itemAttachments;
PathToExtendedFieldType pteftFlagStatus = new PathToExtendedFieldType();
pteftFlagStatus.PropertyTag = "0x1090";
pteftFlagStatus.PropertyType = MapiPropertyTypeType.Integer;
// 定义FindItemType对象,准备获取收件箱中的集合
FindItemType findItemRequest = new FindItemType();
findItemRequest.Traversal = ItemQueryTraversalType.Shallow;
findItemRequest.ItemShape = new ItemResponseShapeType();
findItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.Default;
findItemRequest.ParentFolderIds = new FolderIdType[1];
findItemRequest.ParentFolderIds[0] = firmtInbox.Folders[0].FolderId;
//获取指定收件箱中的邮件集合
FindItemResponseType firt = exchangeServer.FindItem(findItemRequest);
MessageType mt = new MessageType(); //邮件类型
int newEmail = 0;//Unread email number
foreach (FindItemResponseMessageType firmtMessage in firt.ResponseMessages.Items)
{
if (firmtMessage.RootFolder.TotalItemsInView > 0)
{
foreach (ItemType it in ((ArrayOfRealItemsType)firmtMessage.RootFolder.Item).Items)
{
mt = it as MessageType;
if (mt != null)
{
if (!mt.IsRead) //判断邮件是否是已读还是未读
newEmail++;
else
continue;
}
#region Eg codes
#endregion
}
string sf=newEmail.ToString();
}
}
}
MVC 缓存的更多相关文章
- MVC缓存
MVC入门系列教程-视频版本,已入驻51CTO学院,文本+视频学效果更好哦.视频链接地址如下: 点我查看视频.另外,针对该系列教程博主提供有偿技术支持,群号:226090960,群内会针对该教程的问题 ...
- MVC缓存OutPutCache学习笔记 (二) 缓存及时化VaryByCustom
<MVC缓存OutPutCache学习笔记 (一) 参数配置> 本篇来介绍如何使用 VaryByCustom参数来实现缓存的及时化.. 根据数据改变来及时使客户端缓存过期并更新.. 首先更 ...
- MVC缓存OutPutCache学习笔记 (一) 参数配置
OutPutCache 参数详解 Duration : 缓存时间,以秒为单位,这个除非你的Location=None,可以不添加此属性,其余时候都是必须的. Location : 缓存放置的位置; 该 ...
- MVC缓存03,扩展方法实现视图缓存
关于缓存,先前尝试了: ● 在"MVC缓存01,使用控制器缓存或数据层缓存"中,分别在控制器和Data Access Layer实现了缓存 ● 在"MVC缓存02,使用数 ...
- MVC缓存02,使用数据层缓存,添加或修改时让缓存失效
在"MVC缓存01,使用控制器缓存或数据层缓存"中,在数据层中可以设置缓存的有效时间.但这个还不够"智能",常常希望在编辑或创建的时候使缓存失效,加载新的数据. ...
- MVC缓存OutputCacheAttribute 类提高网站效率(转)
原文转自:http://www.cnblogs.com/iamlilinfeng/p/4419362.html 命名空间: System.Web.Mvc 程序集: System.Web.Mvc(在 ...
- MVC缓存技术
一.MVC缓存简介 缓存是将信息(数据或页面)放在内存中以避免频繁的数据库存储或执行整个页面的生命周期,直到缓存的信息过期或依赖变更才再次从数据库中读取数据或重新执行页面的生命周期.在系统优化过程中, ...
- MVC缓存,使用数据层缓存,添加或修改时让缓存失效
在"MVC缓存01,运用控制器缓存或数据层缓存"中,在数据层中可以设置缓存的有用时刻.但这个还不够"智能",常常期望在修改或创立的时分使缓存失效,加载新的数据. ...
- MVC 缓存1
MVC 缓存 为什么要讲缓存.缓存到底有什么作用? 下面我们来说一个场景我们有一个首页菜单的布局基本是不会经常发生的变化,如果动态生成的 Web 页被频繁请求并且构建时需要耗用大量的系统资源,那么,如 ...
随机推荐
- 【转】WiFi基础知识
http://blog.csdn.net/myarrow/article/details/7930131 1. IE802.11简介 标准号 IEEE 802.11b IEEE 802.11a IEE ...
- Codevs 3728 联合权值
问题描述 无向连通图G有n个点,n-1条边.点从1到n依次编号,编号为i的点的权值为Wi ,每 条边的长度均为1.图上两点(u,v)的距离定义为u点到v点的最短距离.对于图G上的点 对(u,v),若它 ...
- 代码阅读分析工具Understand 2.0试用
Understand 2.0是一款源代码阅读分析软件,功能强大.试用过一段时间后,感觉相当不错,确实可以大大提高代码阅读效率.由于Understand功能十分强大,本文不可能详尽地介绍它的所有功能,所 ...
- linux实践之ELF文件分析
linux实践之ELF文件分析 下面开始elf文件的分析. 我们首先编写一个简单的C代码. 编译链接生成可执行文件. 首先,查看scn15elf.o文件的详细信息. 以16进制形式查看scn15elf ...
- C++ 小工具一键解决SVN Clean Up 失败的问题
参考文章: 1.http://blog.csdn.net/luochao_tj/article/details/46358145 2.http://blog.csdn.net/segen_jaa/ar ...
- 转: CentOS安装jdk8
from: http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/ After a long wait, finally Java ...
- 《Linux及安全》实践3.3
<Linux及安全>实践三 字符集总结与分析 [by lwr] 一.ISO.UCS/UTF.GB系列字符集分析 1.字符集&字符编码 字符集(Charset):是一个系统支持的所有 ...
- [原创]Eclipse Mars 在Ubuntu升级后无法工作的解决方法
近日将自己的Ubuntu从14.04LTS升级到了16.04LTS,顿时发现Eclipse不能正常工作了,到Ubuntu的官网上转了一圈发现以下解决方案: 症状: [1]Eclipse启动很慢; [2 ...
- Python学习笔记 for windows 二
函数 abs(-20) //结果为:20,绝对值函数 def 函数名称([参数1,参数2,参数3]): 执行语句 retu ...
- 使用openvswitch 和dnsmasq来实现虚拟机网络隔离
openvswicth : 开源的网络虚拟化软件,可以划分vlan隔离虚拟机,做流量控制 dnsmasq:小心的dns,dhcp服务器 安装openvswicth wget http://openv ...