我在webconfig中加了customErrors节点。来配置自定义作业页面,代码如下:
<customErrors mode="On" defaultRedirect="messageBox.aspx">
<error statusCode="403" redirect="messageBox.aspx" />
<error statusCode="404" redirect="messageBox.aspx" />
</customErrors>
我的网站用到了框架!现在出的问题是。自从加了以上代码后,登陆进去就直接跳到到自定义的错误页面了!我断点看了一下出的错误是session为空!但是我只要把上面自定义错误的页面的代码去掉就没问题!session也不为空!
我加的框架是:
<%@ Page language="c#" Inherits="lnsage.admin._default" CodeFile="default.aspx.cs" %>
<HTML>
<link href="../style.css" rel="stylesheet" type="text/css" />
<head>
<TITLE>框架</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
</head>
<FRAMESET border=0 frameSpacing=0 rows=98,* frameBorder=0>
<noframes>
<center>
<p></p>
</center>
</noframes>
<FRAME name=topFrame src="images/top.aspx" noResize scrolling=no>
<FRAMESET border=0 name=content frameSpacing=0 frameBorder=0 cols=166,*>
<FRAME name=BoardMenu marginWidth=0 marginHeight=0 src="images/menu.aspx" noResize scrolling=no target="main"><FRAME name=main marginWidth=0 marginHeight=0 src="home.aspx" noResize>
</frameset>
</frameset>
</FRAMESET>
</HTML>
<customErrors mode="On" defaultRedirect="messageBox.aspx">
<error statusCode="403" redirect="messageBox.aspx" />
<error statusCode="404" redirect="messageBox.aspx" />
</customErrors>
我的网站用到了框架!现在出的问题是。自从加了以上代码后,登陆进去就直接跳到到自定义的错误页面了!我断点看了一下出的错误是session为空!但是我只要把上面自定义错误的页面的代码去掉就没问题!session也不为空!
我加的框架是:
<%@ Page language="c#" Inherits="lnsage.admin._default" CodeFile="default.aspx.cs" %>
<HTML>
<link href="../style.css" rel="stylesheet" type="text/css" />
<head>
<TITLE>框架</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
</head>
<FRAMESET border=0 frameSpacing=0 rows=98,* frameBorder=0>
<noframes>
<center>
<p></p>
</center>
</noframes>
<FRAME name=topFrame src="images/top.aspx" noResize scrolling=no>
<FRAMESET border=0 name=content frameSpacing=0 frameBorder=0 cols=166,*>
<FRAME name=BoardMenu marginWidth=0 marginHeight=0 src="images/menu.aspx" noResize scrolling=no target="main"><FRAME name=main marginWidth=0 marginHeight=0 src="home.aspx" noResize>
</frameset>
</frameset>
</FRAMESET>
</HTML>
-------------------------------------------------------------------------------------------------
既然去掉错误页面的代码没有问题,session不为空,说明程序可以正常运行
而加了错误也面后,会出现session为空,那原因你需要找出重点为什么session为空.产生的原因的是什么
this.Response.Write("<script language='javascript'>window.open('main.aspx','_self')</script>");
main.aspx为框架。
调试看看session是否为空或null
还有SESSION很容易丢失,能少用就少用