最笨的方法
1.登陆后将角色存入Session
2.写个方法,例如:string xxx(角色),目的是传入不同的角色, 返回一个该角色权限所对应的路径string.
3.取出该角色Session,对该方法进行传参,根据string进行导向对应页面.我只是菜鸟 高人会给你更好的解决方案

解决方案 »

  1.   

    数据库中设置一个字段 假如是user_lever吧!
    当管理员的话ID设置为 1  普通用户的话为0
    然后在代码中通过
             string consql = System.Configuration.ConfigurationManager.AppSettings["access"];
            OleDbConnection con = new OleDbConnection(consql);
            con.Open();
            string sqlcon = "select * from users where User_id='"+TextBox1.Text+"' and User_password='"+TextBox2.Text+"'";
            OleDbCommand sc = new OleDbCommand(sqlcon,con);
            OleDbDataReader dr = sc.ExecuteReader();
            if (dr.Read())//你所要的代码 细节自己修改
            {
                Session["User_id"] = dr["User_id"];//这个可以不要
                Session["user_lever"] = dr["User_lever"];
                if (int.Parse(Session["User_lever"].ToString()) == 0)
                {
                    Response.Redirect("userindex.aspx");//跳转到学生操作首页面
                }
                else
                {
                    Response.Redirect("adminindex.aspx");//跳转到管理员操作页面
                }        }
    你要的效果代码是后半部分 前边的一些是连接数据库什么的!