当前位置: 代码迷 >> ASP.NET >> 至于页面转向
  详细解决方案

至于页面转向

热度:5876   发布时间:2013-02-25 00:00:00.0
关于页面转向

  在主页面上       有个登录框


  有个图像链接     单击图像链接时     如果用户已经登录   则转向正确页面,如果未登录,则转向错误页面   。

  怎么做??

我是这么做的:图像按钮事件如下:

  if   (Session[ "username "]   !=   " ")
                {
                        Response.Write( " <scritp> window.open( 'fbgqxx.aspx '); </script> ");
                }
                else
                {
                        Response.Write( " <scritp> window.open( 'error.aspx '); </script> ");
                }


  怎么有问题啊

------解决方案--------------------------------------------------------
( " <scritp> window.open( 'fbgqxx.aspx '); </script>
scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp scritp
------解决方案--------------------------------------------------------
if (Session[ "username "] != " ")
=======> >
if(Session[ "username "] != null)
------解决方案--------------------------------------------------------
OR
if (Session[ "username "].ToString() != " ")
------解决方案--------------------------------------------------------
我刚刚试的,你上面说的应该好使,下面是我写的
if (Session[ "username "] != null)
{
Response.Redirect( "aa.aspx ");
}
else
{
Response.Redirect( "bb.aspx ");
}
------解决方案--------------------------------------------------------
username是字符串 可以用“”来处理吧 要我写我也跟lz一样
  相关解决方案