public void UploadFile() { if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any()) { // Obtener la imagen subida var httpPostedFile = System.Web.HttpContext.Current.Request.Files["UploadedImage"]; String usuarioId = User.Identity.Name; String tienda = Session["Tienda_Nombre"].ToString(); if (httpPostedFile != null) { byte[] imageBytes = null; using (var binaryReader = new BinaryReader(httpPostedFile.InputStream)) { imageBytes = binaryReader.ReadBytes(httpPostedFile.ContentLength); } ImagenUsuario iu = new ImagenUsuario { UsuarioID = usuarioId, Imagen = imageBytes }; //uC.EliminarImagenUsuario(usuarioId, tienda); uC.AgregarImagenUsuario(iu, tienda); } } }