Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Active Server Pages Object for VFP
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00171104
Message ID:
00172603
Views:
24
>Hello
>
>In VB there is the "Microsoft Active Server Pages Object Library" library that use the classes "Request" and "Response" to get informations from a HTML page and return the header to the ASP script.
>
>Does exist the same thing in VFP 6.0.
>
>Thanks in advance
>
>Stéphan


Stéphan,

You can access the Request and Response objects from a VFP COM instantiated from an ASP script. Simply pass the server objects to your VFP automation server. I personally prefer this over using the FOXISAPI but which approach is best depends on your application needs.
ASP VB Script code:
Set bc = Server.CreateObject("MSWC.BrowserType")
SET ox = Server.CreateObject("vfpasp.vfpasp")
ox.test request, response, bc
ox.release
set ox = nothing
set bc = nothing

Event {Test} code in VFP automation server "vfpasp.vfpasp":

*Request = IIS Server REQUEST object
*Response = IIS Server RESPONSE object
*bc = IIS MSWC.BrowserType object - Must be instantiated from ASP script

LPARAMETER Request, Response, bc

***************************************************************
*Example to return form post data
***************************************************************
PAGEID = Request.Form("PAGEID").Item()
BUTTONVAL = Request.Form("BUTTONVAL").Item()

***************************************************************
*Example to return data past by form get 
*UserID = Request.QueryString("UserId").Item()
***************************************************************

***************************************************************
*Cookie request
*Returns all cookie keys and associated data,
*must be parsed via code
***************************************************************
COOKIEDATA=Request.Cookies("yourcookie").item()

*Write some data back to the client browser
Response.Write('{HTML}{BODY BGCOLOR="C3C3C3"}')
Response.Write("BROWSER_TYPE="+bc.browser+"{BR}")
Response.Write("BROWSER_VER="+bc.version+"{BR}")
Response.Write("BROWSER_BackGroundSounds="+iif(bc.BackGroundSounds,'True','False')+"{BR}")
Response.Write("BROWSER_tables="+iif(bc.tables,'True','False')+"{BR}")
Response.Write("BROWSER_vbscript="+iif(bc.vbscript,'True','False')+"{BR}")
Response.Write("BROWSER_javascript="+iif(bc.javascript,'True','False')+"{BR}")
Response.Write("PAGEID="+PAGEID+"{BR}")
Response.Write("BUTTON SELECTED="+BUTTONVAL+"{BR}")
Response.Write("Cookie Data: "+COODIEDATA+"{BR}")
*Note: I have substituted the html "<" and ">" tags with "{" and "}" so the UT's parser doesn't choke.

This is generally not a problem unless you are generating large html documents but when building html output it's faster to build the output to a string variable to reduce the number of calls to the Response object. There is a considerable amount of overhead associated with calling the Response.write method repetitively. At some point the time required for VFP to append characters to a string varible that's increasing in size will exceed the overhead time to call the Response.write method. The size will vary depending on the VFP version 5 -vs- 6.

You should also check out Rick Strahl's website at http://www.west-wind.com/.
He has an excellent white paper on this called - "Object Messaging with ASP"
Great Job Rick! Wish I'd read it earlier cause it would have saved me hours of work :(.

HTH,
Mike
Michael McLain
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform