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 页被频繁请求并且构建时需要耗用大量的系统资源,那么,如 ...
随机推荐
- Servlet生命周期引起的问题
A:Servlet的定义与作用. B:Serlvet的体系结构 Servlet | | GenericServlet | | HttpServlet | | 用户自定义的Servlet. HttpSe ...
- laravel的门面模式
核心技术是__callStatic()方法,当调用的方法不存在时,会自动调用魔术方法__callStatic()方法,和__autoload()方法同工异曲.
- Android 保存图片到SQLite
[转:原文] Resources res = getResources(); Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.ico ...
- web前端开发学习路径图
第一阶段 WEB前端工程师课程 HTML语句,HTML页面结构.css语法.style属性.link和style标签.id属性.等HTML语句中的相关属性: 通过Dreamweaver制作出跨越平台限 ...
- phongap、APICloud、ionic等app开发平台你都知道吗?
大众创业热,很多人都想在互联网大展拳脚,然而大部分人却是非技术背景.针对这个行业痛点,现在国内外涌现出众多APP开发工具,开发者只要有相关的HTML5.CSS和JavaScript知识,便可以轻松快速 ...
- Mini ORM——PetaPoco笔记
Mini ORM--PetaPoco笔记 记录一下petapoco官网博客的一些要点.这些博客记录了PetaPoco是如何一步步改进的. 目录: Announcing PetaPoco PetaPoc ...
- buildroot--uboot&kernel&rootfs全编译工具
参考: http://www.crifan.com/files/doc/docbook/buildroot_intro/release/html/buildroot_intro.html https: ...
- 对bootstrap中confirm alert进行封装
HTML: <!-- system modal start --> <div id="ycf-alert" class="modal"> ...
- mockjs模拟前后端交互
mockjs是用于mock数据(造假数据)的组件. mockjs官网链接为:http://mockjs.com/:mockjs官网有mockjs的源代码.API以及示例. mockjs拦截ajax请求 ...
- composer [ReflectionException] Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist
在执行composer update时报错 [ReflectionException]Class Fxp\Composer\AssetPlugin\Repository\NpmRepository d ...