FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour App.Ini vs Web.Config
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM

App.Ini vs Web.Config

Posted: 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
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM

Re: App.Ini vs Web.Config

Posted: Fri Jun 05, 2020 05: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
HIX -> https://github.com/carles9000/hix
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM

Re: App.Ini vs Web.Config

Posted: Fri Jun 05, 2020 05: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
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM

Re: App.Ini vs Web.Config

Posted: Fri Jun 05, 2020 05:34 PM
Byron,

You can do

Code (fw): Select all Collapse
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
HIX -> https://github.com/carles9000/hix
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM

Re: App.Ini vs Web.Config

Posted: Fri Jun 05, 2020 05: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

Continue the discussion