现在我想实现这样的功能。只有用户登陆后台管理系统后,(比如添加新闻),点击添加新闻的按扭,才能跳转到addnews.aspx这个页面。
如果用户没有登陆,而是直接在地址栏中输入...addnews.aspx的时候,就使其跳转到首页!!
请问该怎么实现??

解决方案 »

  1.   

    用SESSION里存放用户登录信息,进入addnews.aspx这个页的时候,判断他是否是合法用户,不是就转到首面。
      

  2.   

    public void LoginValite()
    {
       if(LoginUserCode==null)
       {
         Response.Redirect("~/login.aspx");
       }
    }
      

  3.   

    怎样判断是合法的用户???
    原来我在Page_Load函数中是这样写的
    if(Session["userID"].ToString()=="")
    {
       Server.Transfer("index.aspx");
    }
     else
    {
    }但
    是不知道怎么来判断Session["userID"].ToString();的值为空?请zhangxiaopin(zxp) 再说明一下了,谢谢了
      

  4.   

    if(Session["userID"] == null)
    或者
    try
    {
    Session["userID"].Tosting();
    }
    catch(System.NullRefreException)
    {
    Response.redirect("index.aspx")
    }
      

  5.   

    if(Session["userID"]==null)
       Response.Redirect("index.aspx");
    else
    //操作