您的位置:首页 > 产品设计 > UI/UE

smartNavigation=true导致重定向后出现空白页面

2007-11-30 11:16 441 查看
我有一个A.aspx页面,页面的属性smartNavigation设为true,叶面中有一个按钮ButtonA,ButtonA的代码中使用了如下代码:

HttpContext.Current.Session["HintTitle"] = strTitle;

HttpContext.Current.Session["HintBody"] = strBody;

HttpContext.Current.Response.Redirect("/Hint.aspx");

HttpContext.Current.Response.Flush();

HttpContext.Current.Response.End();

在我自己的电脑上一直没出现什么问题,上传到虚拟主机后,点击按钮后,IE的地址栏中的内容保持不变,但是页面变成空白的了。

几经周折,受论坛中高人启示,去掉smartNavigation后,恢复正常。

google了很多,没弄清楚这种状况是怎么出现的,为什么会出现,仅此记之。

这个帖子http://topic.csdn.net/t/20040726/11/3210001.html中提到一种变通的方法,留记。

设置SmartNavigation=ture(页面或者config中)会有异常情况,以下方法可以解决该问题

环境为VS.NET 2000和VS.NET 2003通过

<script language="javascript">

function GetCookie (name)

{

var arg = name + "=";

var alen = arg.length;

var clen = document.cookie.length;

var i = 0;

while (i < clen)

{

var j = i + alen;

if (document.cookie.substring(i, j) == arg)

return getCookieVal (j);

i = document.cookie.indexOf(" ", i) + 1;

if (i == 0) break;

}

return null;

}

function getCookieVal (offset)

{

var endstr = document.cookie.indexOf (";", offset);

if (endstr == -1)

endstr = document.cookie.length;

return unescape(document.cookie.substring(offset, endstr));

}

function SetCookie (name, value)

{

document.cookie = name + "=" + escape (value)

}

</script>

在body中加入

<body bgColor="#f1f5f5" leftMargin="0" topMargin="0" rightMargin="0" MS_POSITIONING="GridLayout" onload="document.body.scrollTop=GetCookie('posy')" onunload="SetCookie('posy',document.body.scrollTop)">
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐