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 页被频繁请求并且构建时需要耗用大量的系统资源,那么,如 ...
随机推荐
- swift-重写方法和属性、禁止重写
/*子类可以为继承来的实例方法,类方法,实例属性,或下标提供自己定制的实现.我们把这种行为叫重写. 如果要重写某个特性,你需要在重写定义的前面加上 关键字.这么做,你就表明了你是想提供一个重写 版本, ...
- eclipse如何配置tomcat运行web项目时省略项目名称
三个关键点,如图所示
- hibernate学习(5)——多对多关系映射
1.创建实体和映射 package com.alice.hibernate03.vo; import java.util.HashSet; import java.util.Set; public c ...
- [dpdk] 熟悉SDK与初步使用 (四)(L3 Forwarding源码分析)
接续前节:[dpdk] 熟悉SDK与初步使用 (三)(IP Fragmentation源码分析) 前文中的最后一个问题,搁置,并没有找到答案.所以继续阅读其他例子的代码,想必定能在其他位置看到答案. ...
- Scipy - Python library - Math tool - Begin
Introduction Scientific Computing Tools for Python. Seen in Scipy.org. Environment Linux, CentOS 7 w ...
- LeetCode Plus One Linked List
原题链接在这里:https://leetcode.com/problems/plus-one-linked-list/ 题目: Given a non-negative number represen ...
- Python学习【第十篇】基础之杂货铺
字符串格式化 Python的字符串格式化有两种方式: 百分号方式.format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存. 百分号方式: ...
- Mongodb在Linux下的安装和启动和配置
第一步:下载mongodb安装包,下载版本:2.0.2-rc2 下载链接: http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.1.tgz 第 ...
- JS/JQ获取各种屏幕的高度和宽度
Javascript: 网页可见区域宽: document.body.clientWidth网页可见区域高: document.body.clientHeight网页可见区域宽: document.b ...
- 关于sigwait
刚开始看sigwait函数,只是知道它是用来解除阻塞的信号,可是使我疑惑的是那么解除了以后为什么线程收到终止信号SIGINT的时候还是没能终止呢? 于是网上找了一些资料,总的理解如下所示: sig ...