ActiveVFP AND NETWORK DBF FILES

Apr 18, 2012 at 11:28 PM

For anyone who may run into a problem using DBFs over the network instead of the same server that AVFP is on,  use the UNC path instead of pointing to a mapped network drive.

Mar 28, 2013 at 8:06 PM
Edited Mar 28, 2013 at 8:07 PM
I just ran on an issue like this, basically this is the explanation.

Using Mapped Drives with IIS
Drive mappings are an extension to the net use command and are created on a per-user basis. That is, the entries for drive mappings exist under the Hkey_Current_User registry key for the user who maps to the network drive. Also, drive mappings are created with the credentials of the user who is currently logged on.

A possible work around is to log in to the console of the Web server as a user who may need to be authenticated through the Web server, and then create the mapped drive as a persistent drive (Reconnect at Logon) for that user account. This can cause performance degradation because the user account that you are connecting with may need to be authenticated twice for access, once by IIS and a second time to create the mapped drive.

The preferred method of accessing content for the Web server that exists on a remote computer is to use shares that follow the universal naming convention (UNC). For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
Dec 29, 2014 at 8:06 AM
Hello All -
Has there been any updates to this theory? I have been testing REST(ext) AVFP 6.03 and all going well.

The issue I am unsure about is the "correct" or "best" method to point to the LAN Data? Claude you suggested recently:
"BTW, for access to LAN VFP data from AVFP (VFP data is not on the same server as AVFP), create a new Application Pool in IIS (or change the existing one) and impersonate it with a user account that has access to the data folder." - Dec 15
But I not sure how to set this completely up...

Currently what is working well as source code in:
"..rest/controllers/<controllername>.prg"

USE ("\UNCMachineName\PathRootShare\ShareSub\datafile.dbf") ALIAS datafile

Of course this machines sits just on my local LAN.
Surely it cannot be this simple! What other components would users suggest from AVFP for authentication and security before the RESTAPI serves out the data?
Thanks in Advance ,Paul.
Dec 29, 2014 at 5:38 PM
It doesn't matter if you access the your data trough a UNC address or a mapped drive, from a security point of view this is. In both cases, you need that the user running the AVFP process has access to that shared folder. You can achieve this by:
  1. Granting access to data folder to the user is currently running the AVFP process (IIS_USER ?)
  2. Impersonating your application pool with an user that already has access over the shared data folder (wich is what Claude is suggesting).
In my experience, solution #2 is easier to implement than solution #1.

Victor Espina
Dec 30, 2014 at 12:59 AM
Thanks Victor and fantastic work on the extensions!

It has taken me quite a few hours understanding the concepts and how you guys have built this product as I have done little Dev work on the Web. Some quick questions if I may:

1) There are use of placeholders in your script like {resource} and {localprg}. Where do these get defined, how are they replaced at run time, is there a list of all placeholders, as they are not HTML?

2) Are you extensions supported in IIS Express and if so what versions? Our clients are NFP Clubs so I can see some non "Server" system deployments such as Win 7 & 8. As our APP is desktop only, the REST API will need to be built off local LANS until we can make the move to the cloud.

Thanks so much again, Paul.
Dec 30, 2014 at 4:52 PM
Thanks Paul

There are two types of placeholders.

a) Paths placeholders (i.e. {path}) are handled by an internal function called AVLocate() and its supported in some plugins, like layouts.prg. Basically you can define a common used path using oDelegate.setPath("name","path") and then expand it in run time using AVLocate: cMyPath = AVLocate("{myPath}/file.txt"). AVFP defines some common used paths like "localFolder", "rootFolder", "localPRG" or "mainPRG".

b) Macros placeholders (i.e. @mymacro@) are handled by the mergescript function and resolved by an internal function called AVURL(). They applies only to HTML markup and you can define them using oDelegate.setMacro("id","value"). I normally use them for net references than can change between my local copy and the online copy. This way, when I publish the site I only have to change that references in my delegate.prg and the whole site takes the change.

Regarding IIS Express, I my self have no idea if AVFP would work or not under that environment. Hope someone else have some information about this use case.

Victor
Dec 31, 2014 at 5:48 AM
Edited Dec 31, 2014 at 5:54 AM
IIS Express works (see documentation here) but it doesn't support anything that was programmed using the IIS variables. Running the avfp demo under IIS Express illustrates this - the path variable is not found since it's assuming IIS is being used. You just need to substitute some other variable that's available in that case.

Just test Victor's stuff using IIS Express.
Jan 3, 2015 at 6:49 AM
Thank you for your detailed replies and seasons greetings to You & Victor!

Claude I am going to run the minimum "bits" of AVFP for our REST API due to possible constraints at each club site. Don't suppose there a quick list of "variables" used in IIS not compatible in IISE? The problem for a "L" Driver like me is to firstly work out the minimum AVFP stuff required for REST; then pick apart the code to establish the variables not available; and then find replacements...

Otherwise what would be helpful is a minimum distro package list to run AVFP REST API 6.03E. My "proof of concept" has probably gone far enough anyway as it is so maybe I will get deeper into the integration requirements with our associates so I can scope the work required.

Regards Paul.
Jan 3, 2015 at 4:50 PM
Maybe running the 'debugging variable dump' in the demo app from iis express will give an idea of what's available and what isn't in iis express:

http://72.219.237.238:444/avfp6/aspvars.avfp