The name "Session" does not exist in the current context (WPF)

-1

Good, I have a desktop application that I'm doing in WPF in Visual Studio and I need to store the identification of a patient in a Session variable to be able to use it in other windows of the application but when I try to create it I get the error "The name "Session" does not exist in the current context ", here I leave part of the code, I hope you can help me, thanks: D

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BLL;



            if(metodos.buscarPaciente(txtRut.Text) == false)
            {
                //Crear paciente
                PacienteBLL miPaciente = new PacienteBLL();

                miPaciente.nombre = txtNombre.Text;
                miPaciente.apePaterno = txtApePaterno.Text;
                miPaciente.apeMaterno = txtApeMaterno.Text;
                miPaciente.rut = txtRut.Text;
                miPaciente.direccion = txtDireccion.Text;
                miPaciente.viveCon = txtViveCon.Text;
                miPaciente.ocupacion = txtOcupacion.Text;
                miPaciente.fk_idEscolaridad = cbEscolaridad.SelectedIndex;
                miPaciente.edad = int.Parse(txtEdad.Text);
                miPaciente.fk_idPrevision = cbPrevision.SelectedIndex;
                miPaciente.ciudad = txtCiudad.Text;
                miPaciente.fk_idEstCivil = cbEstCivil.SelectedIndex;
                miPaciente.motivoConsulta = txtMotivo.Text;

                Session["rut"] = txtRut.Text;

                miPaciente.Crear();
                MessageBox.Show("Paciente registrado con éxito", "Información", MessageBoxButton.OK,MessageBoxImage.Information);
            }
            else
            {
                //Ya existe
            }
    
asked by Roberto Antonio Rico Palma 13.01.2018 в 18:33
source

1 answer

0

Session is in web applications. I suggest you use a class with static properties.

    
answered by 13.01.2018 в 21:46