示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id_usuario = Convert.ToString(Session["id_usuario"]);

            if (id_usuario == null || id_usuario == "" || id_usuario == "0")
            {
                Response.Redirect("default.aspx");
            }
            else
            {
                switch (Convert.ToString(Session["rol"]))
                {
                case "SuperAdministrador":
                    usuarios.Visible = true;
                    break;

                case "Administrador":
                    usuarios.Visible = true;
                    break;

                case "Aprendiz":
                    usuarios.Visible = false;
                    break;

                case "Instructor":
                    usuarios.Visible = false;
                    break;

                default:
                    Response.Redirect("default.aspx");
                    break;
                }
                HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false);
                HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                HttpContext.Current.Response.Cache.SetNoStore();
                // Stop Caching in IE
                Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
                // Stop Caching in Firefox
                Response.Cache.SetNoStore();
                Response.Cache.AppendCacheExtension("no-cache");
                Response.Expires = 0;
                Response.Cache.SetExpires(DateTime.Now);
                Response.Cache.SetValidUntilExpires(true);
                CancelUnexpectedRePost();
                if (!IsPostBack)
                {
                    DTOUsuario user = new DTOUsuario();
                    user.Id = Convert.ToInt32(id_usuario);
                    CADUsuario procesos = new CADUsuario();
                    procesos.CargarPerfil(user, Nombre, Apellidos, correo, NombreUsuario, Image1);
                    NombreRolUsuario.Text = Convert.ToString(Session["rol"]);
                }
            }
        }