protected void btnAgregar_Click(object sender, EventArgs e) { try { if (fileimageFoto.FileName == "") { throw new Exception("No se ha seleccionado ninguna imagen."); } //Guardo la ruta relativa string imagen = "~/Images/" + fileimageFoto.FileName; //Para almacenar necesito la ruta ABSOLUTA fileimageFoto.SaveAs(Server.MapPath(imagen)); //Después de guardar, puedo mostrar img.ImageUrl = imagen; string hotel = txtHotel.Text; string calle = txtCalle.Text; int puerta = Convert.ToInt32(txtNroPuerta.Text.Trim()); string ciudad = txtCiudad.Text; int telefono = Convert.ToInt32(txtTelefono.Text); int fax = Convert.ToInt32(txtFax.Text); bool playa = RBPlaya.Checked; bool piscina = RBPiscina.Checked; int estrellas = Convert.ToInt32(RBEstrellas.SelectedValue); Hotel hot = new Hotel(hotel, calle, puerta, ciudad, telefono, fax, playa, piscina, estrellas, imagen); LogicaHoteles.Agregar(hot); EstadoInicial(); lblMensaje.Text = "Se agregó correctamente el hotel " + hot.NombreHotel + "."; } catch (Exception ex) { lblMensaje.Text = ex.Message; } }