Rick Strahl's FoxPro and Web Connection Web Log

My Links
Blog Stats
Archives
August 2010 (1) April 2010 (1) December 2009 (2) September 2009 (1) April 2009 (2) February 2009 (1)
West Wind News
Web Connection Training at Southwest Fox: Venue Change
Aug. 4, 2010
This year's Southwest Fox conference is moving to a new location and the Web Connection training event prior to the conference is going to move to...

Web Connection Training at Southwest Fox Early Bird Deadline extended
Jul. 16, 2010
We extended the early bird registration deadline for the Web Connection Training at Southwest Fox October 13 & 14 for another 5 days. Register early...

West Wind Client Tools 5.53 released
Jun. 21, 2010
West Wind Technologies has released a maintenance release of West Wind Client Tools. Client Tools provide a host of Internet functionality to client...

  



Show last 50 comments

re: Understanding wwServer::lUnattendedComMode
Aug. 9, 2010 14:36pm | by Mike McDonald

The line in the sample code above..
lnOld2335 = lnSys(2335)
..should be..
lnOld2335 = Val(Sys(2335))
..since Sys(2335) returns a character but expects a numeric input parameter.

Thanks for the details on this setting.

re: Understanding wwServer::lUnattendedComMode
Aug. 5, 2010 14:37pm | by Dan Scott

Thanks Rick. Yes, I thought that would be the case (even though the UI that report form shows when called with NOCONSOLE TO FILE is only a printing progress dialog). I wrapped the command in SYS(2335,0) and all worked fine. Of course if the FRX uses some cursors that aren't available then the server will still lock up with a file dialog, but I can't see any way around that! Thanks for your help.
re: Understanding wwServer::lUnattendedComMode
Aug. 5, 2010 3:37am | by Rick Strahl

REPORT FORM includes UI and so causes an error when running in unattended mode. The workaround is to turn of unattended mode before the report and then turn it back on afterwards (ie. SYS(2335,0) run report then SYS(2335,1)). This will work in an EXE. Note that DLL servers can't run REPORT FORM commands at all.
re: Understanding wwServer::lUnattendedComMode
Aug. 4, 2010 21:28pm | by Dan Scott

Is there any chance this same issue could affect the VFP REPORT FORM command? As we are using the wwPDF class and when lunattendedmode is set to .T. we get User-interface operation not allowed at this time errors when trying to produce PDF. Works fine in file mode or if we set SYS(2335,1) before the:

REPORT FORM (lcReport) &lcExtraReportClauses NOCONSOLE TO FILE &lcTFile

command? Can't find any info on this and from my testing this is the case.

re: Playing Media via Media Player Automation
Jul. 1, 2010 12:31am | by Rick Strahl

I think you can make Media Player Rip a CD from songs, but not record music.

The Lame driver is a converter and it's a DLL you can access fairly easily with WinAPI code in Fox. However, that doesn't help with recording first. Audio recorder might be automatable but there are probably better solutions out there in the form of ActiveX controls. Jim Murez (Harvey Mushman) had been playing around with some of this some time ago and I remember the controls he used weren't very pricey.

re: Playing Media via Media Player Automation
Jul. 1, 2010 8:18am | by hm@zam.net

Did you discover anyway to also record in MP3? If I have the LAME driver on the system, I would think this might be possible but not sure if media player can also record.

--jim

re: Web Connection on IIS 7 and Vista
Jun. 3, 2010 13:13pm | by Rick Strahl

There's a checkbox when you create a script map. It's under the handler mappings and Request Restrictions.

Also make sure that if you're mapping to an ISAPI extension you set the ISAPI/CGI restriction to allow access to the DLL.

re: Web Connection on IIS 7 and Vista
Jun. 3, 2010 11:03am | by Nick

I'm trying to install on IIS 7 & Windows Server 2008, and I keep getting a 404.0 error. It's trying to find a file with the extension that I've mapped, and of course it does not exists. Any suggestions?
re: Understanding wwServer::lUnattendedComMode
May. 14, 2010 1:34am | by Dexter

Thank you very much for this article, Rick - you saved my day, again :)
re: Visual Studio 2008 and Web Connection
May. 4, 2010 0:19am | by Eliza Sahoo

To enable it open an aspx page and follow the following steps:

1. Click on "View"
2. Click on "Formatting Marks"
3. Click on "Show"
4. Repeat step-1 and step-2
5. Click on "Tag Marks"
Now tags will be shown in the design view.
re: Web Connection on IIS 7 and Vista
Apr. 21, 2010 12:35am | by Rick Strahl

I don't know... haven't looked at FoxISAPI in ages. IIS 7 has restrictions against using .dll links directly. you might try using script map links instead.
re: Web Connection on IIS 7 and Vista
Apr. 21, 2010 9:34am | by Simon

Hi Rick, I really need to run FoxIsapi.dll on IIS7, but following the above for adding the CGI and ISAPI restrictions, when ever I try to run the following url: localhost/scripts/foxisapi.dll/status?
I get the 500.0 - Internal Server Error, is it possible to get FoxIsapi.dll working under IIS7, if so what is the correct procedure to get this working,
Thanks
Simon
Using Code Charger - HTTP Error 404.3 - Not Found
Mar. 25, 2010 17:47pm | by Gunnar Weisskamp

Hi I am using Code Charge to create a simple first "Hello World" ASP application. My operating system is Windows Seven Professional. Now when I try to view page in browser I am getting
"HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map."

Now I have tried the following

1 - Checked to make sure that certain settings in the "Turn Windows Features On / Off" for IIS are checked

2 - When I did this I followed you above instructions and made sure that the "IIS Metabase and IIS 6 configuration compatibility" is set.

3 - I even turned the "virtual directory" that I had created in IIS into an “application” directory.

4 – I then explored the “MIME Types” area and added a “.asp” extension. This did get rid of the above initial error “HTTP Error 404.3” but then when I tried to view the page a dialog box “File Download – Security Warning” came up saying “Do you want to open or save this file”. You can click on “open”, “save” or “cancel”. Whichever one you chose does not matter as this is not the expected result in the first place as the page should have just opened up in the browser.
5 – I also made sure that in IIS the page being requested was set as the default page to display

Any help you may have would be great. Kind regards Gunnar

re: Web Connection on IIS 7 and Vista
Mar. 9, 2010 12:52am | by Keith

Thanks for the tip about NOT using Integrated, Rick! It solved the problem I was having with virtual ASPX page links.
re: IIS 7 Default Request Filtering and Web Connection
Feb. 25, 2010 14:32pm | by Scobee

Awesome.. This is exacly the fix that did the trick for me had a binary in the a "bin" directory and this fixed it right away.. though not happy about the vulnerabilty that now exists it is low risk for our internally hosted app.


re: VFP String Concatenation Issue in Loops
Jan. 25, 2010 2:45am | by Eliza Sahoo

Hi,
Its a good one.I also want to share a similar tips with you.
If a table has firstname and lastname as its fields and also we want to show full name on the screen or in a report. The first expression that comes to mind is something of this sort :

SELECT TRIM(lastname)+' , ' + firstname from table .......

Or

SELECT ALLTR(lastname)+' , ' + firstname from table .......


However a easier way is :-

SELECT lastname - (', '+firstname) from table .........

The '-' is a another concatenation operator that removes trailing blanks from the element preceding the operator then joins two elements
there is a difference between using the '-' operator and ALLT in the above example.

The latter removes all blanks from last name while the former moves the trailing blanks from last name and adds them to the end of the resulting expression.
This is handy if you want the size of the resulting field to be equal to the total size of its elements.

re: IIS 7 Default Request Filtering and Web Connection
Jan. 21, 2010 3:08am | by not working for .SVC file

thanks for ur suggestion,
i try this method, when i implemented .svc file, it block the entire site activies, since my project is based on svc file.

Please help me.

<add fileExtension=".svc" allowed="false" />

re: Understanding wwServer::lUnattendedComMode
Jan. 5, 2010 9:56am | by Randy Pearson

You need to explain that this flag gets set by a Config setting, otherwise people will think they need to set the server's property in their subclass.

[Main]
Unattendedcommode=On

re: Root-Relative Paths (~/path) in Web Connection
Dec. 16, 2009 22:42pm | by Rick Strahl

APPL_MD_PATH returns the virtual path. And although you can nest virtuals inside of other virtuals the virtual is always a single name. The path may be nested but the virtual isn't (or at least would be accessible through the short path).

So this appears it's doing exactly what we want - to return just the logical, root relative base path of the current request.

re: Root-Relative Paths (~/path) in Web Connection
Dec. 16, 2009 17:25pm | by Phil Connolly

I think I first wrote that class back before IIS gave us those nice server variables :) Oh well, I still use it for some other purposes where I need to enumerate all the sites and virtuals of a web server....

In my experiences, APPL_MD_PATH returns the paths for the root, unless they are called from within a virtual, then it is the paths for the virtuals. Sites can also create virtuals deep in the site's folder tree:

root->PhysicalSubFolder1->PhysicalSubFolder2->....->VirtualPath

and have the virtual point to any physical path. I don't know what is returned by the server variables for those cases. At any rate it probably doesn't matter for you, the APPL_MD_PATH variable should start with the root moniker no matter where in the virtual tree you request it from so you could extract the root and/or virtual out in all cases except perhaps deeply buried virtuals. Not sure why someone would want to do that... but there is always at least one.

re: Root-Relative Paths (~/path) in Web Connection
Dec. 16, 2009 14:45pm | by Rick Strahl

@Phil - Hmmm... started thinking about this a little a more after your comment. Getting the virtual actually is relatively straight forward since IIS provides the ADSI path which includes the name of the virtual.

How about something like this:

http://codepaste.net/ousyw6

I think this should work. Virtuals are always one level off the root I think - as long as that's true this should work. Older IIS servers that don't include the key or Apache then still use the existing approach.

re: Root-Relative Paths (~/path) in Web Connection
Dec. 16, 2009 11:34am | by Phil Connolly

I don't think there is anything wrong with using a configuration as the basis for path translations. It should be easy enough to manage, especially since the value of the configuration is handled automatically by setup wizard code.

But for an alternative approach, I pasted a class I have been using for years which automates the translation of any virtual path to its physical path. It uses ADSI on its first request to pull virtual path info from your webserver for all websites, then subsequent requests use the cached data (so ADSI is only used on the first lookup).

http://codepaste.net/k5stjh

re: Root-Relative Paths (~/path) in Web Connection
Dec. 11, 2009 13:18pm | by Rick Strahl

Thanks Mike. Kind of a problem when you willfully add those URLs into content, eh? Fixed by injecting spaces into those URLs.
re: Root-Relative Paths (~/path) in Web Connection
Dec. 11, 2009 10:44am | by Mike McDonald

It looks like the automatic post-processing has changed some of the sample URLs that should be "~/" to show up as "/wconnect/weblog/" in your text above.
re: Web Connection on IIS 7 and Vista
Oct. 8, 2009 3:24am | by Srikanth

thanks that worked!!!!
re: Running Web Connection on 64 bit IIS
Jul. 31, 2009 10:35am | by Kevin

Rick you are a life saver, been looking for a solution for hours!!!
re: Web Connection on IIS 7 and Vista
Jul. 8, 2009 22:09pm | by Meher

Hi,

I am getting error 404.4. It says "The resource you are looking for does not have a handler associated with it."
In the "things you can try, it states,
"If the file extension does not have a handler associated with it, add a handler mapping for the extension."
However, it doesn't explain how to do this.
Config of System:

OS: Windows Vista Home Edition.
Browser: IE 7.0
The system has Visual Studio 2008 installed on it. So the application runs on local host.
But it does not have an IIS server installed.

This error cropped up after I tried to run Spike Proxy (Web Application Security Testing tool) on my system, for which I had to change my browser settings. But after using it I changed the settings back to wht they were.
But I am still getting the error.
Please help me with this…..

Thanks

re: Web Connection on IIS 7 and Vista
Jun. 22, 2009 20:46pm | by Rick Strahl

If it's a permission error you need to fix the permissions. Basically the account that you're using on the client needs to be able to authenticate on the remote machine and has to be an administrative account.
re: Web Connection on IIS 7 and Vista
Jun. 9, 2009 6:27am | by SK_RE

Hi Rick, i am actually trying to connect to a II7 (64b) pool from a remote machine, using VFP8.
The command i was used to use on an old Win2000 server is:

IISPool = GetObject('IIS://srv-r8/W3SVC/AppPools/poolname')

This command seems to do not work on the new server and it give me a "OLE ERROR CODE 0x800401ea".

Maybe i'm missing something, it seem to me that its a permissions problem but i really dont know where to look at now.

Do you have any magic idea to get rid of this error?

Thank you.

re: Web Connection Version Updates and Compilation
Feb. 26, 2009 19:16pm | by Rick Strahl

@rudynudy - nope. That will compile only files inside of the EXE/APP, not the files on disk. It doesn't change the FXP files on disk, so if you run the PRGs you may still get version mismatches.
re: Web Connection Version Updates and Compilation
Feb. 26, 2009 18:56pm | by Roodynudy

From the Project Manager, can't you select Build, Rebuild Project, Recompile All files? I'd always believed that this would recompile the WW prgs.
re: Web Connection Version Updates and Compilation
Feb. 22, 2009 2:46am | by Rick Strahl

@Steve - also just to clarify a version number wouldn't have helped anyone in this particular scenario. The problem in the problem above is CONSOLE.EXE and its loading of the same library files out of the EXE vs. the files from disk. So even if the right version of the file exists on disk it's not used because it's already loaded.

This is an issue that I need to manage on my end for sure - and I usually am pretty careful to make sure that CONSOLE.EXE gets compiled and included as the last step before packaging a distributable. Only this time I slipped and didn't update the file.

This is entirely my fault that this happened with shipping these out of sync files but no amount of versioning would have helped this particulare issue.

re: Web Connection Version Updates and Compilation
Feb. 22, 2009 2:42am | by Rick Strahl

@Steve - I'm not quite sure I get what you mean.

Per file version information is next to impossible to manage. How would you consolidate that even with the whole of Web Connection or for that matter for the 5 products that many of these files live in? Dates could be added, but for that you can use the file timestamp - what do you need a version number for on a per file basis?

I agree it's sloppy to have the old dates in there - it's a creating date not a modified date really. I agree versioning is important but my reasoning has been for versioning at the package level (ie. wconnect.h which has always been versioned) rather than at the file level.

I don't see what else would provide useful version information on a file level.

re: Web Connection Version Updates and Compilation
Feb. 21, 2009 8:06am | by Steven Black

The problem, Rick, is actually deeper than that.

In my view, if there's one thing that really needs correcting in Web Connect it's file headers. I think you need to pay more attention to those.

For example, the most recent version of WWUtils says
Modified: 03/10/2003
... and there's no version number anywhere therein. Even the copyright statement is 6-years out of date.

I'll bet if you could audit 10 WC developers who've been at-it a while, you'd find folks with various WC core framework files duplicated all over the place because otherwise there's just no really good versioning story.

At least today the WConnect.H file has version information in it now. That needs to be extended to the other core files as well.

There's a reason you see
Version: @version
... in the raw files stored in the source-control trunks of many open-source projects. Sooner or later, users in framework upgrade scenarios desperately need to know.

**--** Steve

re: Web Connection Version Updates and Compilation
Feb. 20, 2009 5:37am | by Harvey Mushman

This all sounds good and in particular the "COMPILE CLASS" command which might really be the issue in the end since it is the only step, I have not done yet!<g>

But it is hard to understand why the CLOSE ALL, CLEAR ALL would fix that?

re: Visual FoxPro and Vista RTM
Feb. 11, 2009 8:09am | by Gerard Buijze

I've installed the same Foxpro application under Vista Home Premium and under Vista Ultimate. Just clean setup, no settings changed and guess what?? Under Vista Home Premium the "highlighting every row" issue in the combobox occurs but under Vista Ultimate it does not. I checked the compability settings but they were the same too. So my guess is that somewhere else in Vista is causing this different behaviour, but what???

Any comments can be send to foxserv@xs4all.nl subject "Visual Foxpro & Vista"

re: Important Bug Fix Regarding Cookies in Web Connection
Jan. 5, 2009 7:17am | by Rick Strahl

@Phil - you have to re-compile your code after installing new updates. Please check the Web Connection documentation on how to recompile thouroughly.

The issue in most cases is that the FXP files on your system are newer than the PRG files from the update, so unless you delete the FXP files or recompile the PRG files explicitly the updates won't be active. Note that compiling the EXE also doesn't update the FXP files, so unless you run the EXE compiling the project doesn't do anything for updating the FXP files to the latest version.

re: Important Bug Fix Regarding Cookies in Web Connection
Jan. 5, 2009 7:05am | by Rick Strahl

@Nelson - thanks. Actually that should be TRANS(this.vErrorResult). However, that code is never hit in typical Web Connection applications. It's for a special case when non ASP parameters are passed in which isn't done at least not natively in the framework.

If you find bugs like this it's best to report them on the message board when you find them in the bug reports section (or anywhere appropriate for that matter). That way they'll get fixed right away.

re: Important Bug Fix Regarding Cookies in Web Connection
Jan. 5, 2009 6:56am | by Nelson

Since we are talking about hard to find bugs, I don't know if you already fixed this or not, but the class.method wwEval.MergeText has a bug when the text that is being evaluated crashes.
It is this line:

lcResult = THIS.cErrorResult

But the property cErrorResult doesn't exist. It should be changed to cErrorMessage

Additionally, in my project, I also included that message in the output to the screen, so that I know what the problem was. Right now it only says "Invalid Expression" or "Error", which is not very helpful.

re: Important Bug Fix Regarding Cookies in Web Connection
Jan. 5, 2009 5:39am | by Gordon Norris

Hi Rick,

Ironically I've amended this code on several occations to implement custom behaviour. Due to the fact that I do not use cookies that are set to NEVER I didn't worry about. I'm sorry I never brought this to your attention.

I am slightly concerned though, I've always manually fixed projects due to some bad development practices I do. Unfortunately to get things working I've always hacked the base classes. I should really report things I need but getting the job done always come first. Its always a problem with version updates (bug fixes etc) I have to analyze what has changed.

I don't want to go round my apps to fix this and I cannot update them easily. Can I ask whether or not the bug affects my apps if I do not use NEVER cookies? I've had no reports of problems from customers so far.

Many Thanks

Gordon

Problem with FileTime
Jan. 4, 2009 10:32am | by Phil Hollingworth

Hi Rick

Just installed 5.41 and recompiled class PRG & VCX and now get this error:

Error Message: File 'filetime.prg' does not exist.
Error Number: 1
Running Method: getpageclassinfo
Current Code: REPLACE Filename WITH lcPhysical, SourceFile WITH lcSourceFile, Class WITH lcClass, GeneratedClass WITH lcGenerated, SavedTime with FileTime(lcSourceFile)
Current Code Line: 1609
Exception Handled by: Wr08web2_process.OnError()

This error only started after the upgrade and I found the following thread on the boards relating to it: http://www.west-wind.com/wwThreads/default.asp?Thread=2JQ0VOSQY&MsgId=2JQ0YEJJJ

re: Watch out for SYS(2335) in non-COM Applications
Dec. 31, 2008 21:24pm | by HM

Interesting!

...and the rest of this message was trapped because of a test for len(lcString)<g>

re: Showing Windows AutoComplete Dropdowns in Visual FoxPro
Aug. 6, 2008 0:53am | by Rick Strahl

@Craig - not that I know of. I looked around other controls like the Microsoft Forms controls but it didn't work or fit right. There might be third party controls but I didn't want to include them.

The security issue is not really a problem for a desktop app but only when running inside of a hosted and limited security environment like VBA, Office etc... VFP desktop full trust apps shouldn't be affected by this issue.

re: Showing Windows AutoComplete Dropdowns in Visual FoxPro
Jul. 31, 2008 7:42am | by Craig Roberts

Rick. You are using RichTextCtrl which has security problems - http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=69256&SiteID=1 Is there a better OLE object to use in 2008 with VFP 9?

Thanks for ALL of your great contributions.

Re: Other reasons
Jun. 15, 2008 4:32am | by Rick Strahl

@Christof - Yeah I'm aware of a couple of these and in this case we're not explicitly using paths or extensions anywhere so that's not it. Names are also all valid.

My guess is SET PATH can be a problem because there are several paths that include large numbers of files - possibly there's some OS search limit that's tripped in one of the application's library paths.

But what is odd about that is the problem of the COM server being radically slower than the EXE file running standalone for processing effectively the same code. I've never seen this before and I can't make sense of it. <shrug>

Other reasons...
Jun. 11, 2008 10:57am | by Christof Wollenhaupt

When doing tests for AFP I found that there even more factors that affect the performance of calling PRG files:

1) It's faster if you don't specify the path nor extension. Add any of these (eg. DO prgs\myprog or DO myprog.PRG) it's getting slower.

2) If the file name is a valid FoxPro name (starts with alpha or underscore, followed by up to 127 alphas, digits or underscores) and only uses ANSi codes below 128, it's significantly faster.

3) SET PATH TO can affect performance either way.

4) Performance dramatically depends on the number of files in the SET PROCEDURE line. In fact, the differences in my tests were huge enough that I considered moving all of the code in AFP into one PRG file when building the project instead of having one PRG files for every class, basically.

Christof

Finding memory leak in COM Server
Jun. 10, 2008 8:04am | by Darren

any idea how to do this in a COM Server? Clearly SET STEP ON isn't an option! :(
Re: Some new features coming in Web Connection 5.37
May. 30, 2008 21:29pm | by Jorge Mota

Nice Rick! I am using OnClientActivate a lot!
Re: Watch out for _VFP/Application Object hangs with VFP 9 SP2 Installations
May. 9, 2008 3:57am | by Andrew

Thanks Rick - I originally read this post and said "OK good to know" but then I was just recently working with some COM automation and my VFP servers kept on coming back with "execution failed".

Sure enough - that was it.

Re: Running Web Connection on 64 bit IIS
Apr. 30, 2008 1:48am | by Ruben

Hi Rick

I read some post about 32 bits mode running on 64 bits Windows 2003 Server and "Enable32bitAppOnWin64 true" trick. But the result of this is a "Service Unavailable" in a lot of environments. There are not documentation to this error in MSDN or Microsoft Forums. Could you confirm this situtation?

Thanks :)


© Rick Strahl, West Wind Technologies, 2004 - 2010