In normal asp.net, we can get the value of this by giving:
UserSessionID = System.Web.HttpContext.Current.Session.SessionID;
IPAddress = System.Web.HttpContext.Current.Request.UserHostAddress;
How can we get the same in .Net Core. Can anyone help?
Assuming your session is setup like this:
HttpContext.Session.SetString("mysession", "mySessionValue");
Then you can get the Session id:
UserSessionID = HttpContext.Session.Id;
And the user host address:
IPAddress = HttpContext.Connection.RemoteIpAddress;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With