ASP.NET 值不能为空。参数名: value
在网上下了个网站,在VS2005中编译时,出现的错误:值不能为空。参数名:value异常详细信息:System.ArgumentNullException:值不能为空。参...
在网上下了个网站,在VS2005中编译时,出现的错误:
值不能为空。
参数名: value
异常详细信息: System.ArgumentNullException: 值不能为空。
参数名: value
源错误:
行 46: onRemove = new CacheItemRemovedCallback(this.RemovedCallback);
行 47: if (Cache["webname"] == null)
行 48: Cache.Add("webname", foruminfo.webname, null, DateTime.Now.AddSeconds(3600), Cache.NoSlidingExpiration, CacheItemPriority.High, onRemove);
行 49: }
行 50: public void RemovedCallback(String k, Object v, CacheItemRemovedReason r)
源文件: e:\music\Music.Web\header.ascx.cs 行: 48
具体代码如下:
public partial class header : System.Web.UI.UserControl
{
static bool itemRemoved = false;
static CacheItemRemovedReason reason;
CacheItemRemovedCallback onRemove = null;
protected string ulstr = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder ulstrs = new StringBuilder();
string sessionusername = ATools.GetSession("username");
if (sessionusername != "")
{
ulstrs.Append("<a href=\"/usercenter.aspx\">用户中心</a> <a href=\"logout.aspx?u=");
ulstrs.Append(sessionusername);
ulstrs.Append("\">退出中心</a>");
ulstr = ulstrs.ToString();
}
else
{
ulstr = "<a href=\"/login.aspx\">用户登录</a> <a href=\"/register.aspx\">用户注册</a>";
}
ForumInfo foruminfo = new ForumInfo();
foruminfo = Forum.GetWebs();
Nav.Text = foruminfo.webcolumn;
logo.Text = foruminfo.logourl;
onRemove = new CacheItemRemovedCallback(this.RemovedCallback);
if (Cache["webname"] == null)
Cache.Add("webname", foruminfo.webname, null, DateTime.Now.AddSeconds(3600), Cache.NoSlidingExpiration, CacheItemPriority.High, onRemove);
}
public void RemovedCallback(String k, Object v, CacheItemRemovedReason r)
{
itemRemoved = true;
reason = r;
}
} 展开
值不能为空。
参数名: value
异常详细信息: System.ArgumentNullException: 值不能为空。
参数名: value
源错误:
行 46: onRemove = new CacheItemRemovedCallback(this.RemovedCallback);
行 47: if (Cache["webname"] == null)
行 48: Cache.Add("webname", foruminfo.webname, null, DateTime.Now.AddSeconds(3600), Cache.NoSlidingExpiration, CacheItemPriority.High, onRemove);
行 49: }
行 50: public void RemovedCallback(String k, Object v, CacheItemRemovedReason r)
源文件: e:\music\Music.Web\header.ascx.cs 行: 48
具体代码如下:
public partial class header : System.Web.UI.UserControl
{
static bool itemRemoved = false;
static CacheItemRemovedReason reason;
CacheItemRemovedCallback onRemove = null;
protected string ulstr = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder ulstrs = new StringBuilder();
string sessionusername = ATools.GetSession("username");
if (sessionusername != "")
{
ulstrs.Append("<a href=\"/usercenter.aspx\">用户中心</a> <a href=\"logout.aspx?u=");
ulstrs.Append(sessionusername);
ulstrs.Append("\">退出中心</a>");
ulstr = ulstrs.ToString();
}
else
{
ulstr = "<a href=\"/login.aspx\">用户登录</a> <a href=\"/register.aspx\">用户注册</a>";
}
ForumInfo foruminfo = new ForumInfo();
foruminfo = Forum.GetWebs();
Nav.Text = foruminfo.webcolumn;
logo.Text = foruminfo.logourl;
onRemove = new CacheItemRemovedCallback(this.RemovedCallback);
if (Cache["webname"] == null)
Cache.Add("webname", foruminfo.webname, null, DateTime.Now.AddSeconds(3600), Cache.NoSlidingExpiration, CacheItemPriority.High, onRemove);
}
public void RemovedCallback(String k, Object v, CacheItemRemovedReason r)
{
itemRemoved = true;
reason = r;
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询