0

I am beginner in DNN. I am creating a module which provides Login, Dashboard and Add-Update Form. I have data in JSON format. I want to store it temparory while user use the website. Data will be destroy as soon as user will close the website.

Currently I have created a folder in my Solution Explorer of project in Visual Basic and created 3 .json files which stores login_info.json, basic_info.json and auth_info.json. I write json data whenever user login and I make it blank when user logout.

Above method is working fine now but I afraid it will work when I will publish this module. Also I may have situation where I need to store image some where. I don't know how I will manage.

  1. Can anybody please guide me?
  2. Is this proper way to store data temparory in DNN?
  3. Is there any other better way?

After getting one of reply for Database Suggestion Is there any table which same as User Meta in DotnetNuke? enter image description here

Nanji Mange
  • 2,155
  • 4
  • 29
  • 63
  • What is the difference with [this question](http://stackoverflow.com/questions/40603288/how-to-store-data-temporarily-in-dotnetnuke-7/40610031) of yours? You can strore the json as string in the cache as well. And you can always use a `Session` – VDWWD Jan 04 '17 at 15:10
  • @VDWWD Can you please suggest me lifetime of Cache? My data can be updated whenever user change setting or login. – Nanji Mange Jan 05 '17 at 03:34
  • Cache is supposed to be temporary. But why not use the DNN database then to store data in your custom table? – VDWWD Jan 05 '17 at 08:07
  • @VDWWD I am new in DNN. I don't know database mechanism in DNN. I am creating a Module that can be use by any DNN based website. Is there any default Database that can I use for testing in while developing module? And will it work same when it will be use in other website? Please guide me. – Nanji Mange Jan 05 '17 at 13:40

1 Answers1

1

You use the ConnectionString that is used by DNN and access the database as you would normally.

DotNetNuke.Common.Utilities.Config.GetConnectionString()

Or you can use the Data Access Layer that the DNN Framework supplies. For that take the Christoc Templates. In there is all you need to communicate with the DB.

VDWWD
  • 35,079
  • 22
  • 62
  • 79
  • Thanks. I have edited my question and added a screenshot of Database. Wordpress having `wp_usermeta` table which is link to `User` table where I can save anything in Key and Value. Is there any kind of table in DotnetNuke DB or I need to create by myself? – Nanji Mange Jan 13 '17 at 04:12
  • 1
    You can do both. But using the build-in DNN functions would be better. You can use custom profile properties for example: http://stackoverflow.com/a/25537677/5836671 – VDWWD Jan 13 '17 at 07:45