Example #1
0
    public static void grabarImagen()
    {
        BLL.ImagenHome cImagenHome = new BLL.ImagenHome();

        try
        {
            if (HttpContext.Current.Session["nuevaimagenhome"] != null)
            {
                cImagenHome.subirImagen((byte[])HttpContext.Current.Session["nuevaimagenhome"]);
                HttpContext.Current.Session["nuevaimagenhome"] = null;
            }
            else
            {
                throw new Exception("No hay una nueva imagen para grabar.");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            cImagenHome.Dispose();
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BLL.ImagenHome cIH = new BLL.ImagenHome();
        try
        {
            HttpContext.Current.Session["nuevaimagenhome"] = null; //inicializar

            this.imghome.Src = "data:image/jpeg;base64," + Convert.ToBase64String(cIH.obtenerImagen());
        }
        catch (Exception)
        {
            PieMenu.sErrores = "msgerr = 'OcurriĆ³ un error obteniendo la imagen de la HOME';";
        }
        finally
        {
            cIH.Dispose();
        }
    }