惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
D
DataBreaches.Net
雷峰网
雷峰网
WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Engineering at Meta
Engineering at Meta
月光博客
月光博客
V
Visual Studio Blog
美团技术团队
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
博客园 - 【当耐特】
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 聂微东

博客园 - 沉默杨

[转]ie6下表格宽度超宽bug,问题的解决方法(兼容ie6,7,8,ff) c#高级编程第六版读书笔记二(委托) c#高级编程第六版读书笔记 两列布局右侧自适应ie6bug - 沉默杨 - 博客园 iframe自适应宽度和高度 - 沉默杨 - 博客园 jquery选择器笔记 Sql Server 2005 row_number()分页性能测试比较 ie6兼容的bug调整 fckeditor提交失败返回内容变html的解决方法 .net环境下ckeditor与ckfinder学习笔记 ckfinder与fckeditor 2.6.5集成 seo.你的网站犯了多少错? 程序员必不可少的firefox插件推荐 SEO专题之七:如何提高PR值 seo专题之六:页面优化 最牛B的英汉翻译,笑傻了ba ... seo专题之五:title,keywords,description标签 SEO专题之四:如何合理有效选定关键字 SEO专题之三:SEO与网站开发
vs2010的bug
沉默杨 · 2010-04-30 · via 博客园 - 沉默杨

 准确的说,我不知道这是不是算vs2010一个bug,因为我对.net的运行机制也没啥太多的研究,基本上全靠自学,这个问题困扰了我两天,所有的方法都试遍了,还找了园子里面几个朋友帮忙,描述如下:

aspx页面继承adminpage.

代码

public partial class post_categories :AdminPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
rptList.DataSource
= Post.Getcategories(0);
rptList.DataBind();
}
}
}

adminpage页面

代码

public class AdminPage:System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
if (!StatusObject.CheckCookie("user"))
{
WebHint.PageError(
"非法访问,你还没有登录" "../admin_login.aspx");

}

base.OnInit(e);
}
}

原意就是在adminpage类中判断cookie是否存在。不存在则返回到登录页面,就是这段代码导致了aspx页面所有的web控件全部无法显示。全部提示:

error creating error-控件id
Object reference set to an instance of an object

最终在msdn找到了答案,将判断cookie的这段代码先行注释了,恢复了正常,描述如下:

We are seeing this error because at the design time, some objects such as Session, are not available, or being null. However, the project still runs perfectly at runtime.

To workaround the issue, you can add code to check for the existence of the Session object as shown below, then the design view will render correctly.
We are considering adding a fix for this issue during the VS 2010 SP1 timeframe.
详见:http://blogs.msdn.com/webdevtools/archive/2010/04/15/rendering-issue-in-visual-studio-2010-when-accessing-the-session-state-in-the-oninit-method.aspx


  困扰了两天的问题解决,心里面真是一块石头落地,文章很初级,如果管理员觉得不合适,可以撤下首页。
  顺祝:“五一节快乐”