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 缓存的更多相关文章

  1. MVC缓存

    MVC入门系列教程-视频版本,已入驻51CTO学院,文本+视频学效果更好哦.视频链接地址如下: 点我查看视频.另外,针对该系列教程博主提供有偿技术支持,群号:226090960,群内会针对该教程的问题 ...

  2. MVC缓存OutPutCache学习笔记 (二) 缓存及时化VaryByCustom

    <MVC缓存OutPutCache学习笔记 (一) 参数配置> 本篇来介绍如何使用 VaryByCustom参数来实现缓存的及时化.. 根据数据改变来及时使客户端缓存过期并更新.. 首先更 ...

  3. MVC缓存OutPutCache学习笔记 (一) 参数配置

    OutPutCache 参数详解 Duration : 缓存时间,以秒为单位,这个除非你的Location=None,可以不添加此属性,其余时候都是必须的. Location : 缓存放置的位置; 该 ...

  4. MVC缓存03,扩展方法实现视图缓存

    关于缓存,先前尝试了: ● 在"MVC缓存01,使用控制器缓存或数据层缓存"中,分别在控制器和Data Access Layer实现了缓存 ● 在"MVC缓存02,使用数 ...

  5. MVC缓存02,使用数据层缓存,添加或修改时让缓存失效

    在"MVC缓存01,使用控制器缓存或数据层缓存"中,在数据层中可以设置缓存的有效时间.但这个还不够"智能",常常希望在编辑或创建的时候使缓存失效,加载新的数据. ...

  6. MVC缓存OutputCacheAttribute 类提高网站效率(转)

    原文转自:http://www.cnblogs.com/iamlilinfeng/p/4419362.html 命名空间:  System.Web.Mvc 程序集:  System.Web.Mvc(在 ...

  7. MVC缓存技术

    一.MVC缓存简介 缓存是将信息(数据或页面)放在内存中以避免频繁的数据库存储或执行整个页面的生命周期,直到缓存的信息过期或依赖变更才再次从数据库中读取数据或重新执行页面的生命周期.在系统优化过程中, ...

  8. MVC缓存,使用数据层缓存,添加或修改时让缓存失效

    在"MVC缓存01,运用控制器缓存或数据层缓存"中,在数据层中可以设置缓存的有用时刻.但这个还不够"智能",常常期望在修改或创立的时分使缓存失效,加载新的数据. ...

  9. MVC 缓存1

    MVC 缓存 为什么要讲缓存.缓存到底有什么作用? 下面我们来说一个场景我们有一个首页菜单的布局基本是不会经常发生的变化,如果动态生成的 Web 页被频繁请求并且构建时需要耗用大量的系统资源,那么,如 ...

随机推荐

  1. Unity运行时检测Altas使用情况

    UI贴图在游戏中内存大小中占的分量非常非常大,尤其对于前期对UI没有规划的项目,无论是包量还是内存大小都是需要花费很多时间去优化.如果涉及到战斗场景和逻辑场景的情况下,常用的做法就是把两个场景使用的a ...

  2. mysql中影响myisam引擎写入性能的三项设置

    一.LOW_PRIORITY1.对于myisam默认是写操作优先,读操作滞后.通过该项更改,可以使读操作优先,写操作在有空闲的时候再写入.但该项可能在理论上造成,写被永远阻塞. SQL语句中使用示例: ...

  3. selenium项目的实战经验

    以前学习selenium,最接近项目的经验就是写了百度首页和自己开发的一个小网站的脚本,当时觉得差不多可以了.然而这次项目实战才发现还是学到不少知识,毕竟这个网站的专业程度远超过我自己写的,而且复杂程 ...

  4. 从一道NOI练习题说递推和递归

    一.递推: 所谓递推,简单理解就是推导数列的通项公式.先举一个简单的例子(另一个NOI练习题,但不是这次要解的问题): 楼梯有n(100 > n > 0)阶台阶,上楼时可以一步上1阶,也可 ...

  5. C++ 在Windows下截取整个屏幕 和 指定句柄窗口的屏幕

    #include <windows.h> #include <stdint.h> #include <stdio.h> void ShootScreen(const ...

  6. Linq to Sql : 并发冲突及处理策略

    原文:Linq to Sql : 并发冲突及处理策略 1. 通过覆盖数据库值解决并发冲突 try { db.SubmitChanges(ConflictMode.ContinueOnConflict) ...

  7. 使用二级域名访问本地localhost网站

    将C:\Windows\System32\drivers\etc\hosts文件,修改如下.保存该文件时会提示没有权限,解决的方法是用管理员权限打开记事本. # localhost name reso ...

  8. Go语言的GOPATH与工作目录详解

    这篇文章主要介绍了Go语言的GOPATH与工作目录详解,本文详细讲解了GOPATH设置.应用目录结构.编译应用等内容,需要的朋友可以参考下 GOPATH设置 go 命令依赖一个重要的环境变量:$GOP ...

  9. [转]搬瓦工换机房换ip之后不能连外网

    搬瓦工换机房换ip之后不能连外网 时间 2015-07-21 15:17:16  Wendal随笔 原文  http://wendal.net/2015/07/21.html 主题 iptables ...

  10. Python开发【前端】:HTML

    HTML HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标记).相当于定义统一的一套规则,大家都来遵守他,这样就可以让浏 ...