How can I store data (for example: Config file) in MVC without using Sql, when im using third-party class, when I have no access to the Server proparty?
I want the data to remain in a subdirectory of the website.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use any format you like for the files: XML, JSON, … whatever you feel comfortable with. There are serializers built directly into the framework which will allow you to directly serialize/deserialize your objects into those formats.
Just one thing to bare in mind if you decide to go that route: multithreading. Make sure that you properly synchronize the access to this file or you could get corrupted data if you have concurrent readers and writers. Think for example user A saving his settings (and thus writing to the file) while User B is reading his settings => you will end up with corruption. One technique to properly synchronize access to such shared resource is to use the ReaderWriterLockSlim class.