框架内的页面出现错误时,如何将框架重定向到指定的ErrorPage.aspx
.NET 提供两种方法
1.web.config 中的 customErrors redirect
2.Global.asax 中的 Application_Error
都能定向错误页面,但只能在错误页面本身重定向,而 不能实现 整体框架的重定向
摸索了半天,无解......
求助中
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<frameset rows="70,*,29" cols="*" framespacing="1" frameborder="NO" border="1">
<frame src="head.aspx" name="topFrame" scrolling="NO" noresize >
<frame src="middle.aspx" name="middleFrame"scrolling="auto">
<frame src="foot.aspx" name="bottomFrame" scrolling="NO" noresize>
</frameset>
</html>
但
问题点数:20、回复次数:3Top
1 楼hotbuild(小白.net)回复于 2006-03-04 21:24:21 得分 0
Main.aspx
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<frameset rows="70,*,29" cols="*" framespacing="1" frameborder="NO" border="1">
<frame src="head.aspx" name="topFrame" scrolling="NO" noresize >
<frame src="middle.aspx" name="middleFrame"scrolling="auto">
<frame src="foot.aspx" name="bottomFrame" scrolling="NO" noresize>
</frameset>
</html>
///////////////////////
当head.aspx页面出现异常时间如何将main.aspx页面重定向 errorpage.aspx ERTop
2 楼exboy(kuku)回复于 2006-03-04 21:39:01 得分 20
当页面出错时,程序会在服务器端直接转到错话页面,就像使用 Response.Redirect 方法一样,不能控件页面在哪个目标窗口中打开。
你可以重写页面的 OnError 方法,来自己实现错误页面的转向:
protected override void OnError(EventArgs e)
{
Server.ClearError();
string script = "<script language=\"javascript\">top.location = '" + url + "'";
Response.Write(script);
}Top
3 楼hotbuild(小白.net)回复于 2006-03-05 14:50:04 得分 0
谢谢 exboy(kuku)
Top




