HttpContext.Current.Session is null which inturn causing issues in my web application

48 Views Asked by At

I set up web application in my laptop and configure sessionstate as InProc but fail to create new HttpSessionStateWrapper(HttpContext.Current.Session) which is throwing HttpContext.Current.Session can not be null when I debug in Visual Studio 2019.

i even tried changing my web.config file

please find the below code i was facing issues .

 public JarSessionWrapper SessionWrapper
    {
        get
        {
            if (_sessionWrapper == null && HttpContext.Current != null)
            {
                _sessionWrapper = new   JarSessionWrapper(new HttpSessionStateWrapper(HttpContext.Current?.Session));
            }

            return _sessionWrapper;
        }
    }

public JarSessionWrapper(HttpSessionStateBase session)
    {
        this.session = session;
    }

    public JarSessionWrapper()
    {
        session = new HttpSessionStateWrapper(HttpContext.Current.Session);
    }

i was getting null in the values

HttpContext.Current.Session

thats pReventing to pass the login check . same thing used by others working it s an issue only in my system

0

There are 0 best solutions below