I\'m trying to access session storage in a razor view for a .net core 2.0 project. Is there any equivalent for @Session[\"key\"] in a .net 2.0 view? I have not found a working e
As others have mentioned, I think the real solution here is not to do this at all. I thought about it, and while I have a good reason for using the session, since the razor tags are only useful for the initial page load anyway it makes more sense to just populate the view model in the controller with the stored session values.
You can then pass the view model with the current session values to your view, and access your model instead. Then you don't have to inject anything into your view.