Storing data temporarily in ASP.NET MVC

3

I need to store some strings temporarily in an ASP.NET MVC application, these strings need to be accessible by the application's server-side at any time, and the application itself will be in charge of undoing those stored strings .

What is the ideal way to accomplish this in ASP.NET MVC?

    
asked by anonymous 28.03.2016 / 16:22

1 answer

2

Obviously it has several solutions and without knowing every detail I would not know how to say which one is best.

If you just need to be in the current application you can use the state in HttpContext.Application " (See also the state object ). This is just a specific dictionary that can save any data. Example Usage . And applied examples .

Other more manual mechanisms can be used, some based on the cache system.

If it needs and something external to the application. It could even be a service that stores it in memory, but has simpler solution that must meet the requirements. Play in a file that can be read. I doubt you'll find a simpler solution.

If you have competition issues from whoever is writing this and do not want to handle the file on your own, play it in a database, even if it is SQLite. Many would choose this by default. If you already use it, it might even be better. If you use a database (probably), create a table with a column and a line is so simple that I do not see why not do it (could have some reason, but nothing described indicates this).

It has more complex but unnecessary solutions.

Something that can help .

    
28.03.2016 / 17:01