I'm trying to use Session
but the normally way i do its not working.
[HttpPost]
[Route("FiltroSiltDet")]
public HttpResponseMessage FiltroSiltDet(string DT_INCLUSAO)
{
try
{
HttpSessionState Session = HttpContext.Current.Session;
Session["DT_INCLUSAO"] = "test";
Session["DT_INCLUSAO"] = DT_INCLUSAO;
List<AcompanhamentoSiltDetDTO> retorno = new List<AcompanhamentoSiltDetDTO>();
using (AcompanhamentoSiltBLL oBLL = new AcompanhamentoSiltBLL())
{
retorno = oBLL.AcompanhamentoSiltTransacaoDet(DT_INCLUSAO);
}
var resp = Request.CreateResponse<List<AcompanhamentoSiltDetDTO>>(HttpStatusCode.OK, retorno);
return resp;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
I always used session this way and its not working now.
When it try to pass value to the session I get this error.
Object reference not set to an instance of an object
Someone know what why its not working.
I'm using a MVC application, I Always used this session method in web Forms I'm new in Asp.Net MVC.