未将对象引用设置到对象的实例 我晕
Public Class mandtselect : Inherits UserControl
Public message As Label
Public txtfl As DropDownList
Public la1 As Label
Public mydatagrid As DataGrid
Public keyword As TextBox
Public txtName, txttime, txtsort, txtrdy, txtcon, txtinman As TextBox
Sub page_load(ByVal sender As Object, ByVal e As EventArgs)
if session( "user_name ")= " " then
response.redirect( "..\man_right.aspx ")
elseif session( "user_roles ")=1 then
message.text=session( "user_name ") & " 您好! "
end if
其中message.text=session( "user_name ") & " 您好! "出错为
System.NullReferenceException: 未将对象引用设置到对象的实例
这个代码在我另外一个页面 就没有问题。。。为什么 写的方法也一样。。。
------解决方案--------------------出错时,Session( "userName ")的值是null.所有出错。