###未将对象引用设置到对象的实例。 一般在C#中造成“未将对象引用设置到对象的实例”错误都是控件名称与codebehind里面的没有对应像这里的问题的话,最好把你怎么定义JobPrincipal贴出来 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 奇怪,看不出来这错误通常都是没有对一个对象进行 new可你的对象 new 了呀 肯定是JobPrincipal的定义有问题,建议贴出来分析 要实例化yourclass myclass = new youclass(); 应该是JobPrincipal 定义有问题 我也不知道什么原因, 我把下面的代码放到Page_Load中就没事了,没有放到Global.asax.cs的Application_AuthenticateRequest。 if(Context.User.Identity.IsAuthenticated) { if(!(Context.User is JobPrincipal)) { JobPrincipal newUser = new JobPrincipal( Context.User.Identity.Name ); Context.User = newUser; } }还有个重要的问题就是我昨天晚上FormsAuthentication.SetAuthCookie( uname.Text, true ); 今天起来Context.User.Identity.IsAuthenticated的值是trueContext.User.Identity.Name的值是uname.Text,??怪了 C#2005智能设备怎么连接PC的数据库 如何实现修改用户名 这样使用SerialPort串口通讯有问题吗? 关于控件TreeView的问题,知情者请入内,谢谢 [求助]请问用C#怎么直接产生.bib文件? 一个关于dataGrid的奇怪问题,请大家来看看! RDLC报表自定义数据源却无法显示的问题,急求各位指点! 提交FROM的问题 那位大虾知道水晶报表的资料???高分!! C#编写.net风格的菜单。 连接不能用? 难啊!!大家来看:各位大大有没有办法用线程启动一个IE实例
这错误通常都是没有对一个对象进行 new
可你的对象 new 了呀
yourclass myclass = new youclass();
没有放到Global.asax.cs的Application_AuthenticateRequest。
if(Context.User.Identity.IsAuthenticated)
{
if(!(Context.User is JobPrincipal))
{
JobPrincipal newUser = new JobPrincipal( Context.User.Identity.Name );
Context.User = newUser;
}
}
还有个重要的问题就是我昨天晚上
FormsAuthentication.SetAuthCookie( uname.Text, true );
今天起来
Context.User.Identity.IsAuthenticated的值是true
Context.User.Identity.Name的值是uname.Text,??怪了