예제 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(ISPCFG.Msce.clswfIndex));
            }
            catch (System.Exception)
            {
                string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
                clsProcessError ProcessError    = new clsProcessError();
                ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
                ProcessError = null;
            }

            if (Page.Request.QueryString["ReturnUrl"] != null)
            {
                //System.Web.Security.FormsAuthentication.SignOut();
                string strWarningMessage = "Usted ha sido redireccionado a esta página porque no tiene acceso a: <b>" + Page.Request.QueryString["ReturnUrl"] + "</b>. " +
                                           "Probablemente usted introdujo directamente la dirección URL en la barra de direcciones de su navegador. Si es así, por favor, utilice las " +
                                           "opciones que le proporciona la aplicación y si usted está recibiendo este mensaje y utilizó una opción disponible a través de la aplicación, " +
                                           "por favor, contacte con los administradores del sistema porque es probable que halla algún problema en la configuración de seguridad de la aplicación.";
                clsProcessError ProcessError = new clsProcessError();
                ProcessError.ShowPageWarningNotification(this.tr_Notify, this.sp_Notify, "ACCESO DENEGADO.", strWarningMessage);
                ProcessError = null;
            }
        }               // Fin de Page_Load()
예제 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (HttpContext.Current.Request.QueryString["downloadFile"] != null)
            {
                try
                {
                    string             strFileName = HttpContext.Current.Request.QueryString["downloadFile"].ToString();
                    clsMiMaletin       MiMaletin   = new clsMiMaletin(HttpContext.Current.User.Identity.Name);
                    System.IO.FileInfo fInfo       = MiMaletin.secureDownload(strFileName);
                    // Write the stream to the byte array
                    HttpContext.Current.Response.AddHeader("Content-disposition", "attachment; filename=" + strFileName);
                    HttpContext.Current.Response.AddHeader("Content-Length", fInfo.Length.ToString());
                    HttpContext.Current.Response.ContentType = "application/octet-stream";
                    HttpContext.Current.Response.WriteFile(fInfo.FullName);
                    HttpContext.Current.Response.End();
                }
                catch (System.Exception)
                {
                    clsProcessError ProcessError = new clsProcessError();
                    ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, "No se puede descargar el fichero seleccionado.");
                    ProcessError = null;
                }
            }

            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(clswfMiMaletin));
            }
            catch (System.Exception)
            {
                string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
                clsProcessError ProcessError    = new clsProcessError();
                ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
                ProcessError = null;
            }

            // Para cuando se suben ficheros.
            if (Request.Files.Count > 0)
            {
                try
                {
                    clsProcessError ProcessError = new clsProcessError();
                    ProcessError.ClearPageErrorNotification(this.tr_Notify, this.sp_Notify);
                    ProcessError = null;
                    clsMiMaletin MiMaletin = new clsMiMaletin(HttpContext.Current.User.Identity.Name);
                    MiMaletin.agregarFicheros(Request.Files);
                    MiMaletin = null;
                }
                catch (System.Exception Ex)
                {
                    clsProcessError ProcessError = new clsProcessError();
                    ProcessError.ShowPageWarningNotification(this.tr_Notify, this.sp_Notify, string.Empty, Ex.Message);
                    ProcessError = null;
                }
            }
        }