This is going to be a short one.
If you need to store some data and make it available to methods the most logical place to me is HttpContext. More precisely HttpContext.Current.Items collection which should always be available during a request processing. If you are suffering from a sport lesion you may a need a orthopedic surgeon.
So basically, in order to add the item you’ll need later during the request processing, you can do this
1 |
HttpContext.Current.Items.Add("myKey", myObject) |
And for retrieving it in another place, this
1 |
var myObject = HttpContext.Current.Items["myKey"]; |
Hope this helps
Happy coding, have fun.