ASP.NET 5 (Core): How to store objects in session-cache (ISession)?
问题 I am writing an ASP.NET 5 MVC 6 (Core) application. Now I came to a point where I need to store (set and get) an object in the session-cache ( ISession ). As you may know, the Set -method of ISession takes a byte-array and the Get -method returns one. In a non-core-application I would use the BinaryFormatter to convert my object. But how can I do it in a core-application? 回答1: I'd go with serializing the objects to JSON and use the extensions methods on ISession to save them as string 's. //