App.Ini vs Web.Config

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

App.Ini vs Web.Config

Postby byron.hopp » Tue Jun 02, 2020 11:03 pm

In harbour winforms applications we seem to store specific information for our apps in the .ini file. On the web it seems it is stored in web.config. Does mod_harbour have a way to read and write from a web.config file as harbour does with .ini's?

Thanks,
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: App.Ini vs Web.Config

Postby Carles » Fri Jun 05, 2020 5:10 pm

Hi,

I think you can write/read yiur file config like a usual file. And for example you can use memowrit/memoread for it

C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1137
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: App.Ini vs Web.Config

Postby byron.hopp » Fri Jun 05, 2020 5:14 pm

Yes, thank you, good point. I was looking for a class that may make it easier like the oIni class that allows us to read and write to INI files.
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: App.Ini vs Web.Config

Postby Carles » Fri Jun 05, 2020 5:34 pm

Byron,

You can do

Code: Select all  Expand view
function main()

    local cIni      :=  hb_GetEnv( "PRGPATH" ) + '/myini.txt'
    local hIni  := {=>}
   
    hIni[ 'name' ] := 'Charly'
    hIni[ 'last' ] := time()
    hIni[ 'age'  ] := 52

    //  Save your ini
    memowrit( cIni, hb_jsonencode( hIni ) )
   
    //  Read your ini
    h := hb_jsondecode( memoread( cIni ))
   
    ? h[ 'name' ]
    ? h[ 'last' ]
    ? h[ 'age' ]


retu nil
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1137
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: App.Ini vs Web.Config

Postby byron.hopp » Fri Jun 05, 2020 5:51 pm

Below is a minimal web.config example from Microsoft Support.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>

</system.web>
</configuration>
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 5 guests

cron