未将对象引用设立到对象的实例&当前上下文不存在名称
未将对象引用设置到对象的实例&当前上下文不存在名称
不加if (Session["MyForbid"] != null)这一句,
提示未将对象引用设置到对象的实例,加上提示当前上下文不存在名称“MyForbidString”
public partial class System_CompanyForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["MyForbid"] != null)
{
string MyForbidString = Session["MyForbid"].ToString();
}
if (MyForbidString.IndexOf("E2") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
错误1 当前上下文中不存在名称“MyForbidString”(红色的)
麻烦高手帮忙看看,O(∩_∩)O谢谢
------解决方案--------------------
------解决方案--------------------
不加if (Session["MyForbid"] != null)这一句,
提示未将对象引用设置到对象的实例,加上提示当前上下文不存在名称“MyForbidString”
public partial class System_CompanyForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["MyForbid"] != null)
{
string MyForbidString = Session["MyForbid"].ToString();
}
if (MyForbidString.IndexOf("E2") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
错误1 当前上下文中不存在名称“MyForbidString”(红色的)
麻烦高手帮忙看看,O(∩_∩)O谢谢
------解决方案--------------------
if (Session["MyForbid"] != null)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("E2") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
------解决方案--------------------
public partial class System_CompanyForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["MyForbid"] != null)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("E2") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}