ASP.NET缓存包含解决方案路径
为什么我的缓存对象包含一个包含以下内容的条目?它不应该是空的吗?如果没有,很明显,缓存对象中有一个丑陋的默认值…如何删除它?我还没有向缓存对象添加任何内容,但它包含以下项ASP.NET缓存包含解决方案路径,asp.net,webforms,outputcache,Asp.net,Webforms,Outputcache,为什么我的缓存对象包含一个包含以下内容的条目?它不应该是空的吗?如果没有,很明显,缓存对象中有一个丑陋的默认值…如何删除它?我还没有向缓存对象添加任何内容,但它包含以下项 __System.Web.WebPages.Deployment__C:\Users\Danny\Documents\Visual Studio 2010\Projects\LearningAOP\WebAppCachingII\WebAppCachingII\***C:\Users\Danny\Documents\Visu
__System.Web.WebPages.Deployment__C:\Users\Danny\Documents\Visual Studio 2010\Projects\LearningAOP\WebAppCachingII\WebAppCachingII\***C:\Users\Danny\Documents\Visual Studio 2010\Projects\LearningAOP\WebAppCachingII\WebAppCachingII\
下面是我的ASP.NET代码,标记有一个单项目符号列表控件
using System;
using System.Collections;
using System.Linq;
using System.Web.UI.WebControls;
namespace WebAppCachingII
{
public partial class CachingDemo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
foreach (DictionaryEntry cacheditem in Cache)
{
var concatstring = cacheditem.Key + "***" + cacheditem.Value;
listOfCacheItems.Items.Add(new ListItem(concatstring));
}
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CachingDemo.aspx.cs" Inherits="WebAppCachingII.CachingDemo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:BulletedList ID="listOfCacheItems" runat="server" /> </div>
</form>
</body>
</html>
使用系统;
使用系统集合;
使用System.Linq;
使用System.Web.UI.WebControl;
命名空间WebAppCachingII
{
公共部分类CachingDemo:System.Web.UI.Page
{
受保护的无效页面加载(对象发送方、事件参数e)
{
foreach(字典进入缓存中的cacheditem)
{
var concatstring=cacheditem.Key+“***”+cacheditem.Value;
添加(新的ListItem(concatstring));
}
}
}
}
你在
web.config
中有
元素吗?没有,我应该用谷歌搜索吗?
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<caching>
<outputCache enableOutputCache="false" />
</caching>
</system.web>
</configuration>