Aside from being a bad, bad pattern in general, are there any ramifications of doing something like this to store an object as a property on the nancy module for the life of the request? Everything looks okay but not sure if this will result in any weirdness at scale... ie, cross-talk between requests, memory leaks, general shenanigans.
public class APIModule : NancyModule
{
public SomeConvolutedThing MyThing { get; set; }
public APIModule()
{
Before += ctx => {
try
{
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(HttpContext.Current.Request.Cookies["MyThing"].Value);
MyThing = JsonConvert.DeserializeObject<SomeConvolutedThing>(ticket.UserData);
}
catch
{
MyThing = null;
}
return null;
};
Get["/api/callit"] = parameters => {
// check on status of MyThing before deciding what to return
};
}
}