Wiki Home

ASPand VFP


Namespace: VB
[Irrelevant material has been trimmed.]

[20:31] *** Topic is 'ASP and VFP', [2000.08.30] 9PM ET, 6PM PT, 0100GMT+

[20:38] {CarlosEtcheverry} May I ask, what is PWS ?

[20:38] {MikeHelland} Personal Web Server

[20:38] {Evan Delay} Gracias

[20:38] {MikeHelland} Do you have PWS or IIS installed Carlos?

[20:38] {CarlosEtcheverry} Thanks

[20:38] {CarlosEtcheverry} No

[20:38] {MikeHelland} What Windows do you have?

[20:38] {CarlosEtcheverry} W98

[20:39] [MikeHelland:#internet AWAY]

[20:39] {MikeHelland} Denis, can you quick tell us how you get PWS up in Windows 98?

[20:39] {MikeHelland} Carlos, go to Start | Programs | Accessories | Internet Tools

[20:40] {MikeHelland} Do you have anything that starts with PWS in there?

[20:40] {DenisChasse} But for me it was not Internet tools but Internet Explorer

[20:40] {MikeHelland} Oh, maybe thats it, Internet Explorer

[20:40] {MikeHelland} Anyone else not have PWS or IIS?

[20:42] {CarlosEtcheverry} I have "Asistente para la publicacion en WEB" there and appears to install it

[20:42] {DenisChasse} Carlos: Did you find PWS?

[20:42] {NadyaNosonovsky} I don't have PWS or IIS.

[20:42] {MikeHelland} Oh, ok

[20:42] {MikeHelland} What OS, Nadya?

[20:42] {NadyaNosonovsky} Wind 98

[20:43] {NadyaNosonovsky} Home computer

[20:43] {MikeHelland} Go to Start | Programs | Internet Explorer and look for something called PWS

[20:44] {NadyaNosonovsky} Where? IE doesn't have menu, only IE

[20:44] {DenisChasse} Carlos: Read the instructions. You will need youd Windows 98 CD. You should be able to complete the installation

[20:44] {MikeHelland} How about Internet Tools, Nadya?

[20:45] {CarlosEtcheverry} yes, I saw it, so I have to install PWS and MTS ?

[20:45] {DenisChasse} Carlos: Yes

[20:45] {CarlosEtcheverry} ok

[20:45] {MikeHelland} Go to Settings | Control Panel | Add\Remove Programs | WIndows Setup

[20:45] {NadyaNosonovsky} Ok, I don't have them either. Do I have to check original CD?

[20:45] {MikeHelland} ANd under INternet Tools there should be a PWS or Web Publisher or something like that, do you see it Nadya?

[20:49] {NadyaNosonovsky} Ok, I found Personal Web Server under Internet Tools 0,2 MB already checked. So, does it mean, it's already in a system? Where I have to check?

[20:49] {MikeHelland} Carl, you know that DLL and ASP isn't the mhMessageBoard Code

[20:50] {CarlKarsten} it is getting there...

[20:50] {MikeHelland} Look for an HTM file that contains PWS

[20:50] {MikeHelland} Nadya

[20:50] {MikeHelland} Those files are actually apart of my mhASPSite file, its a data driven web page using VFP DBFs

[20:52] {DenisChasse} Nadya: did you execute it?

[20:52] {CarlosEtcheverry} Well I installed, but gives an error that MTS is not installed.

[20:52] {NadyaNosonovsky} I found pws_main.htm, but haven't run it yet.

[20:52] {DenisChasse} Carlos: I have the same problem but Mike said that we would'nt need MTS tonight.

[20:52] {MikeHelland} Really... hmm, I hope it doesn't make a difference

[20:52] {DenisChasse} Nadya: Do it.

[20:53] {CarlosEtcheverry} well , now I have to restart, then go again to this chat, do I have to do anything more?

[20:53] {DenisChasse} Nadya: In the instructions you will learn how to complete the installation

[20:53] {MikeHelland} Unless Windows 98 PWS is radically different than WIndows 95

[20:54] {DenisChasse} Carlos: I don't know because that's what I did but I don't think so

[20:54] {CarlosEtcheverry} ok

[20:54] {NadyaNosonovsky} Ok, I'm building it right now. It kiks me out of UT main screen :(

[20:55] {CarlKarsten} Mike, i think I am done.

[20:56] {MikeHelland} VFPandASP2 is the wrong ASP file, though.

[20:56] {CarlKarsten} Better make sure I didn't mix anything up

[20:56] {MikeHelland} Its pointing to the Objects.asp

[20:56] {CarlKarsten} doh

[20:57] {CarlKarsten} Mike - i still have the original - fix coming...

[20:57] {MikeHelland} ok

[20:57] {NadyaNosonovsky} :( Haven't time to finish the installation. Hopefully, it would not ask me to restart my computer :)

[20:57] {Evan Delay} Hey Frank and Sylvain.

[20:57] {DenisChasse} Sylvain: Do you have PWS installed?

[20:58] {SylvainDemers} Denis: No.

[20:58] {DenisChasse} Nadya: You have to restart your computer :-(

[20:58] {DenisChasse} Sylvain: You'll need it tonight.

[20:59] {MikeHelland} Its MS, what do you expect, I had to reboot when I load HTML Help Workshop, now how lame is that?

[20:59] {NadyaNosonovsky} An unknown error occurs while making MTS specific changes to the Sr. Error code=0x800405

[20:59] {DenisChasse} I had the same thing. Just continue the installation. Then only MTS will be missing.

[21:00] {CarlKarsten} To view one of my pages: _ASPandVFP2

[21:00] {Evan Delay} Okay everyone. Order Order.

[21:00] {Evan Delay} < Bang! > < Bang! >

[21:01] {Evan Delay} Tonight's speaker is Mike Helland. Mike is a frequent contributor to the Universal Thread, a VFP MVP and has written for Foxtalk.

[21:01] {Evan Delay} The topic is "ASP and VFP".

[21:02] {Evan Delay} Take it away, Mike.

[21:02] {MikeHelland} Ok, well, first off, before I mention exactly what ASP is, I'll do a very basic recap of HTML and HTTP.

[21:02] {MikeHelland} Its a very simple way to view files off one server through a client. The client is your web browser.

[21:03] {MikeHelland} HTML is a markup language that fomats these files in a pretty fashion. Unfortunaly, HTML was intially limited to static pages, and there for just capable of a presentation. More recently, we have had the notion of programming the web, and we've started to create Dynamic Pages

[21:05] {MikeHelland} Some of these pages included Client Side Scripts, which means, a scripting langauge would run on the client machine, at the web browser.

[21:05] {MikeHelland} Things like Java Script, you know, standard stuff. We also have Server Side Scripts now.

[21:06] {MikeHelland} In the Windows OS, MS gives us a couple options for that. One of them is Active Server Pages.

[21:06] {DenisChasse} Would the server side be the ISP?

[21:07] {MikeHelland} It would be whereever the ASP file exists, which could be at an ISP or it could be on your home computer if your running software like IIS or PWS.

[21:07] {MikeHelland} So, who all has PWS or IIS running?

[21:08] {MikeHelland} You need IIS 3.0 or later to run ASP paegs, keep that in mind for the NT Server folks.

[21:08] {MikeHelland} Carlos, if its installed, it typically runs at startup.

[21:08] {MikeHelland} Do you have a new icon in your Systray?

[21:09] {CarlosEtcheverry} Ohh, yes, it was the new Icon, but what I do with it ?

[21:09] {MikeHelland} Put your mouse over it

[21:09] {CarlosEtcheverry} Yes

[21:09] {MikeHelland} If its says "Personal Web Server is Running"

[21:09] {MikeHelland} You're in business :-)

[21:10] {CarlosEtcheverry} Yes...

[21:10] {MikeHelland} It should be a large white blob with a blue thing below it

[21:10] {MikeHelland} Hehe, for lack of a better word

[21:10] {MikeHelland} Ok, now, you have a web publishing service running.

[21:10] {NadyaNosonovsky} Ok I see 'Publish' icon

[21:11] {MikeHelland} If you haven't modified it

[21:11] {MikeHelland} Your default WWW Publishing Root should be: C:\INetPub\wwwRoot.

[21:12] {MikeHelland} Ok, let's start off by putting an HTM file in there, create a new file, add the line "Hello World" to it, and save it as: c:\inetpub\wwwroot\hello.htm

[21:13] {MikeHelland} Ok, now you can fire up your browser, and point it to: http://localhost/hello.htm

[21:13] {MikeHelland} Your file should now come up in the Browser, is anyone having a problem with that?

[21:15] {MikeHelland} Create a file in your C:\InetPub\wwwroot folder, called hello.htm, and add some text to it: Hello World

[21:15] {CarlosEtcheverry} Yes, how I go to create the html?

[21:15] {NadyaNosonovsky} Ok, I did. Till now it's fine

[21:15] {MikeHelland} You can create it by using Notepad, and save it as an HTM file.

[21:16] {MikeHelland} Now, your computer automatically recognizes the domain: http://localhost/ if you have a Web Publishing Service running.

[21:17] {MikeHelland} So, if you point the URL to http://localhost/hello.htm you shuld see your file.

[21:17] {MikeHelland} Ok, the next part is making an ASP file, this is too easy - you simply rename "hello.htm" to "hello.asp" and look for http://localhost/hello.asp

[21:18] {MikeHelland} Any body not seeing this?

[21:19] {MikeHelland} Alright, now thats not a very impressive display of ASPs ability, so lets spice up the page a little bit.

[21:19] {MikeHelland} First I'll point you towards a file you can test as an ASP, then I'll describe exactly what you're seeing

[21:19] {MikeHelland} Take a look here: _ASPandVFP1. You can triple click the code block and copy to get what you need

[21:20] {MikeHelland} (Internet Explorer doesn't carry over the Carriage returns if you just select and paste, but the triple click works, for your information)

[21:21] {MikeHelland} Ok, take that code, and put it in a text file in your C:\INetPub\wwwRoot and call it "Hello2.ASP." Is everyone there?

[21:23] {MikeHelland} After you create the file, you can Browse it in http://localhost/Hello2.ASP

[21:24] {DenisChasse} I guess that it should've been different font sizes but not in my browser.

[21:24] {FrankCamp} Yes, its working, only is should have said morning instead of day going. (3:24 AM)

[21:25] {MikeHelland} Why, Denis?

[21:25] {GeorgeScapin} What browser? IE?

[21:25] {CarlKarsten} Mike, I am not getting any "Hello Worlds" either...

[21:26] {DenisChasse} Because < font size=< %=x%}}

[21:26] {MikeHelland} Thats how its supposed to be.

[21:27] {CarlKarsten} Yea, i get the 'time on the server is 8:27:30 PM.'

[21:27] {DenisChasse} Anyway you said you would explain what happened in there. I won't try to go ahead of you.

[21:27] {MikeHelland} Frank, I see what you mean, thats a typo in the ASP.

[21:27] {MikeHelland} #12:00:00 AM# should be #12:00:00 PM#

[21:27] {MikeHelland} Ok. Lets take a look at our ASP file.

[21:28] {FrankCamp} Mike, I bet there are not so many AM people here right now :-)

[21:28] {MikeHelland} Hehe, I agree :-)

[21:28] {GeorgeScapin} weird, mine shows 8:22 PM

[21:28] * KennethDowns thinks that is very funny...

[21:28] {MikeHelland} Why is that wierd?

[21:28] {GeorgeScapin} Shows am on some and pm on others?

[21:28] {MikeHelland} It should be exactly the time on YOUR computer.

[21:28] {GeorgeScapin} Mine is correct.

[21:29] {MarkusVoellmy} or server :)

[21:29] {MikeHelland} Thats what's happening, the Script is being executed on wherever the ASP file resides and is served.

[21:30] {MikeHelland} THat means, if you had a static IP address, for example (does anyone have one we can test?) that I could hit your server and show me the time on your PC

[21:30] {MikeHelland} Thats the difference between client side (like some JScript apps you see) and server side.

[21:30] {KennethDowns} I have a static IP, but I'm a little lost here....

[21:30] {MikeHelland} Do you have the ASP working, Kenneth?

[21:31] {KennethDowns} yes, and boy oh boy is it neat.

[21:31] {MikeHelland} Would you mind telling us your static IP?

[21:31] {MikeHelland} There we go, if we all look at George's link. We can see that the clock on his computer is 2 minutes fast :-)

[21:32] {MikeHelland} Lets look at another part of the ASP

[21:32] {DenisChasse} Mike: is hello2.asp supposed to be showing with different font sizes?

[21:32] {MikeHelland} Yes.

[21:32] {MikeHelland} First all, we have "Hello World" on the page once, but it shows up 5 times in different sizes

[21:32] {MikeHelland} How does it do that?

[21:33] {GeorgeScapin} A loop?

[21:33] {DenisChasse} Not here same size all 5 of them.

[21:33] {MikeHelland} Well, the <% and %} means that the text in between is going to be executed as VBScript.

[21:34] {MikeHelland} So, like George said, its just doing a FOR loop. It does all the HTML in the middle and comes back up to the FOR at the END FOR.

[21:34] {MikeHelland} The loop should make sense to us, but if you haven't done ASP before, the mix of VBScript and HTML should be pretty exciting.

[21:35] {MikeHelland} Also, notice the < font size= < percent =x percent} piece. X is the variable, defined in the For loop. In order to implant the variable into the HTML, we just use < percent =Variable percent}

[21:36] {AaronLowe} Do you need VB installed on your server to do this?

[21:37] {MikeHelland} I don't believe so, the VBScript should be installed with the ASP DLL

[21:37] {MikeHelland} Its not VB, its VBScript remember.

[21:37] {MikeHelland} Ok, is anyone not understanding what happened with the inline server script?

[21:38] {NadyaNosonovsky} Where does it execute?

[21:38] {GeorgeScapin} Time is a special variable?

[21:38] {MikeHelland} We now have simple pages that can conditionally show HTML (like with the IFs) or in a loop, and you can do anything else VB Script can do inside of your web page, to return dynamic contecnt to the browser

[21:39] {MikeHelland} THe script executes where you access the page.

[21:39] {MikeHelland} So, if its localhost/ the script is running on your PC because of PWS

[21:39] {NadyaNosonovsky} So, on client side

[21:39] {MikeHelland} Nope, on the server side

[21:39] {MikeHelland} Time is a method I think

[21:39] {DenisChasse} Client is IE?

[21:39] {GeorgeScapin} ah

[21:39] {MikeHelland} But VB lets us get by without ()

[21:39] {MikeHelland} Yep, the client is the browser.

[21:40] {CarlKarsten} The browser tells the server what page to get, the server then gets the page, but the asp extention tells it to look for asp commands.

[21:40] {MikeHelland} Right-O Carl

[21:40] {Jim_Munn} If you are running PWS, then your machine (PWS) is the server and your machine (IE) is the client.

[21:40] {MikeHelland} Yes, Jim

[21:40] {CarlKarsten} Tells the server to look for ASP commands.

[21:40] {NadyaNosonovsky} Suppose, I'm a client. I open ASP page from the server. Which time should I see? On which side it would execute?

[21:40] {CarlKarsten} The server executets them, and returns the resulting text to the browser.

[21:40] {MikeHelland} As far as Internet Explorer knows, Nadya, the Time is hardcoded in that file.

[21:41] {MikeHelland} Because the Server executes and sends it before the client even gets to it.

[21:41] {GeorgeScapin} Cool, you get to hide source code...

[21:41] {MikeHelland} Yes!

[21:41] {CarlKarsten} Nadya - the server's time.

[21:42] {MikeHelland} ASP also allows you to define INCLUDE files for a web page.

[21:42] {MikeHelland} An example of this is in a Zip file: includes.zip.

[21:42] {NadyaNosonovsky} So, it would not be my time!

[21:42] {GeorgeScapin} Does Apache on Linux allow for ASP?

[21:43] {MikeHelland} Nadya, it would be your time

[21:43] {MikeHelland} You ARE the server too

[21:43] {MikeHelland} If you are using localhost/

[21:43] {CarlKarsten} I think "my time" is to vauge for this.

[21:43] {Jim_Munn} Mike...you may want to have people look at the source from IE to clear things up.

[21:43] {Evan Delay} George, yes. See ChiliSoft.com.

[21:43] {MikeHelland} Thats a good point Jim.

[21:44] {NadyaNosonovsky} Right now I'm speaking about if I would not have PWS, but just looking on asp on Web.

[21:44] {GeorgeScapin} Cool

[21:44] {MikeHelland} If you viewed the Hello2.asp in IE

[21:44] {MikeHelland} ANd clicked on View Source...

[21:44] {MikeHelland} ... it would show you 5 Hello Worlds, there would be no mention of <% %} or VB script anywhere

[21:45] {CarlKarsten} "on the web" = a web server somewhere, running the .asp, and sending the results to your browser

[21:45] {MikeHelland} ..5 "Hello Worlds", ...

[21:45] {MikeHelland} In any case, I'm gonna touch up a little on the inlcude file.

[21:45] {MikeHelland} If you include the line:

[21:46] {MikeHelland}

[21:46] {MikeHelland} Into an ASP file, it would stuff all the contents of header.htm into the ASP file at the position of the line.

[21:46] {MikeHelland} An example of this is in a Zip file: includes.zip.

[21:46] {MikeHelland} This is useful for two reasons: You can give all of your pages the same look and feel by reusing the same file as apart of your page. You can have multiple Includes as well

[21:48] {JeffHelland} Question....can the include files include scripts?

[21:48] {MikeHelland} So, if all 500 web pages at a corporate site use INCLUDE files for say, the copyright information, changing the one include file would make a change an all 500 of your web pages

[21:49] {MikeHelland} Yes, the include file can include scripts, because, the file contents are added before any processing is done.

[21:49] {JeffHelland} Would they need the extenstion .asp?

[21:49] {MikeHelland} Kind of like in VFP, where the #DEFINE and #INLCUDE is done all at COMPILE-time not runtime.

[21:50] {MikeHelland} Nope, the Inlcudes don't need ASP extensions for the same reason.

[21:51] {MikeHelland} Since you can create function calls in VB (there is an example of this in the same Zip file as the Inlcude example) ... you can create libraries of VB Script that reside in one file

[21:52] {MikeHelland} All you need to do to use that routine is #INCLUDE it in your ASP. You now have resuable code in your web pages.

[21:54] {MikeHelland} The ASP Scripting stuff includes several objects. The two most important ones are the Request and the Response objects. Lets start with the Response object.

[21:55] {MikeHelland} Like I mentioned before <%=Var%} inserts the variable into the HTML. You can also accomplish this using the Write() method of the Response object

[21:55] {MikeHelland} Reponse.Write(Var)

[21:56] {MikeHelland} It still needs to be somewhere between <% and %}, but it can be in a large block of code.

[21:56] {MikeHelland} Another useful Response method is Redirect(), which, like it implies, can redirect you to another site.

[21:57] {MikeHelland} < %Response.Redirect("http://www.CNN.com")% > will throw you to the CNN whenever you acces a page containing that line.

[21:57] {MikeHelland} I've got an example of these objects, so I'm going to move through them before I show it to you.

[21:58] {MikeHelland} The next object is the Request object. The Request object is used to gather data passed to the page. For example, if you have a web page with a form

[21:58] {MikeHelland} Regular HTML Form < form action=myasp.asp method=post >

[21:59] {MikeHelland} If there is a submit button, clicking it will take you to myasp.asp.

[21:59] {MikeHelland} If there were any textboxes on that form, those values are now available to you from the Request.Form() collection.

[22:00] {MikeHelland} Another method of gathering data is using the QueryString() collection of Request.

[22:00] {MikeHelland} It works in a similar way, but instead of getting data from form inputs, it uses the URL of the current page.

[22:00] {MikeHelland} For example, say you had MyAsp.ASP, and you called it like this: http://localhost/MyASP.ASP?var1=Mike

[22:01] {MikeHelland} Within the ASP, you can issue: lcVar1 = Request.QueryString("var1")

[22:02] {MikeHelland} Now you have a web page that can accept your input. Let's look at an actual example.

[22:02] {MikeHelland} Create an ASP file that uses that code and run it. Does anyone still need help with that part?

[22:03] {Evan Delay} Where is objects.asp?

[22:04] {MikeHelland} Where do you see that?

[22:04] {CarlKarsten} Evan - in the same directory as the other test programs.

[22:04] {MikeHelland} Oh, Objects.ASP is what you should name this sample, because it calls itself through the Form.

[22:04] {DenisChasse} How do I execute it?

[22:05] {CarlKarsten} Cut and paste the code into a file: objects.asp, like you would the other ASP examples we've done, in the browser with http://localhost/objects.asp.

[22:06] {DenisChasse} That's what I needed from you Mike: But How do I execute ASP on my own?

[22:06] {DenisChasse} onw = own

[22:06] {MikeHelland} I'm not sure I understand Denis.

[22:07] {MikeHelland} You are executing the ASPs on your own

[22:08] {DenisChasse} I mean you give us a url to click. How do I do it from my machine without your HTTP...

[22:08] {MikeHelland} Its not my HTTP, its yours, you can just use INternetExplorer to do it.

[22:08] {GeorgeScapin} LocalHost is your machine.

[22:08] {DenisChasse} I understand.

[22:08] {MikeHelland} Go to the Address Box, and type it in just how I see it.

[22:09] {MikeHelland} Ok, lets look at the HTML. Now, we see a variable being defined at the top of the page. We can also see that same variable being displayed with: < %Response.Write(lcSession)% >. That variable is a form object with a textbox and a button. Whenever the button is pressed, the ACTION= clause of the < FORM > tag is executed, so basically we are just going back to the same file we started with. However, if there was a value present in the text box, it is now accessible in the Request.Form Collection. If the box is name "uname" we get the value with: Request.Form("uname"). Also, notice the use of the Session Object. We are using the Session to mantain values throught the life of the browser. Once the browser is lcosed the session is abandoned. You can also Abandon it prematurely with Session.Abandon() or set a time out: Session.Timeout = 20. This will destroy the session if idle for more than 20 minutes.

[22:14] {MikeHelland} You store the values like this: Session("variable") = "value", and you can retireve the value of a Session variable simply like: Session("variable").

[22:15] {MikeHelland} Is everyone still with me?

[22:15] {MikeHelland} There is another object, called Server. The server has been described as the ASPs tool box. Server has a method called CreateObject(). Look familiar?

[22:16] {MikeHelland} You can create a COM object inside your ASP page. This means you can create and use the File Script Object, WIndows Script Host.

[22:17] {MikeHelland} You can use ADO to connect a web page dricetly to an ODBC datasource and show and edit Data thoruhg an HTML interface.

[22:17] {GeorgeScapin} Object must be located on server?

[22:17] {MikeHelland} You can even create instances of COM Dlls created in out beloved FoxPro!

[22:18] {MikeHelland} Yes, the COM needs to be registered on the server. DCOM can be used too to use objects on differenct computers.

[22:18] {MikeHelland} So, lets do a simple test here.

[22:18] {GeorgeScapin} What about if you are using a web server on a Linux or Unix machine?

[22:18] {MikeHelland} Who hasn't created a VFP COM object?

[22:19] {MikeHelland} I don't know about that, I think Jason Nance and I have talked a little (he's a Linux guy) and didn't know for sure. But you'll have to find out for us, George :-)

[22:19] {MikeHelland} Ok., creating COMs in 5 minutes, you ready? Open up VFP, and create a new project where ever you'd like. Call it ASPSample. Now, add a new PRG to the project, and call it anything.

[22:20] {MikeHelland} Add this code to the PRG:

DEFINE CLASS AspSample AS CUSTOM OLEPUBLIC

    Name = "AspSample"
    
    FUNCTION TestCOM
    RETURN "TestCOM is alive and well!"
    
ENDDEFINE

[22:21] {MikeHelland} This is creating a non-viusal class if you aren't familar with it. All its doing is giving it one fucntion "TestCOM". (Notice the OLEPublic class in the first line)

[22:24] {CarlKarsten} This code is at _ASPandVFP6~TestTest. Just triple-click to select it and add it to your program.

[22:25] {MikeHelland} Alright, now, all you need to do is click on the project manager, and choose a build type of Single Threaded COM/DLL. This created a DLL called AspSample.dll and it has a class in it called ASPSample too.

[22:26] {ShuliHamaoui} Is there any OTHER type besides "single threaded"?

[22:26] {DenisChasse} Why single-threaded and not multi-threaded?

[22:27] {MikeHelland} Yes, there are multithreaded DLLs to run in MTS and all that jazz. But we're gonna use Single Threaded just to be as simple as possible.

[22:27] {SimonGaudiuso} [22:28] {MikeHelland} VFP 5.0 will work.

[22:28] {MikeHelland} Now, if you look at _ASPandVFP6~VFP again, you will see an ASP page at the bottom, put that bottom code block into an ASP page and run it.

[22:29] {MikeHelland} While you do that, I will explain a little. VBScript uses SET to create an object reference and Server.CreateObject("aspsample.aspsample") returns an object reference to the object it just created. The object is stored in ASPSample.DLL (the one previous to the ".") and contains a class called "aspsample" (after the dot).

[22:31] {MikeHelland} So, you should be able to see that the ASP Page create an object, called a function in that object, and printed its return value to the HTML Browser. This means you can call VFP code. You can even pass values from the Form or QuerySting Collection to the method if you'd like, meaning you have a web page, powered by VFP that uses VFP code to do anything (except show UI, like MessageBox or WAIT WINDOW).

[22:33] {MarkusVoellmy} Mike -- DCOM? How? I've no VFP on the server .... Not yet :)

[22:34] {NadyaNosonovsky} If you want to show table's content, how should you do it?

[22:34] {MikeHelland} Nadya, first the smae way in VFP. You open up the Table: USE MyTable SCAN and then you look at all the records. The only difference is, you need to build an HTML string to return to the ASP page. And then END SCAN. Does that make sense?

[22:35] {DenisChasse} Yes

[22:35] {NadyaNosonovsky} And all this in COM, right? Quite simple.

[22:35] {MikeHelland} Yeppers

[22:36] {NadyaNosonovsky} So, for instance, I can build Help table driven.

[22:36] {MikeHelland} If you create your COM class with an OnStartPage method, and have it accept a parameter to store, you can actually control the ASP objects from your VFP COM.

[22:37] {MikeHelland} Think about that a little bit, by adding:

PROCEDURE OnStartPage

*Grab the object and store

*it for future use

LPARAMETER toASPPage

THIS.oASP = toASPPage

ENDPROC

[22:37] {MikeHelland} In my class definition I can now do This.oASP.Response("Hello From VFP") right in a VFP Class method.

[22:38] {ErikMoore} Mike, do you have a strategy for testing your ASP COM classes from the command window?

[22:39] {MikeHelland} Now, you can create Session Variables, use the Form or QueryString collections of Request, and Write() from response and never leave VFP.

[22:39] {MikeHelland} Erik, I usually prototype the COM and test from the command window.

[22:39] {SimonGaudiuso} Question: Where do I find build type single thread com/dll?

[22:40] {ErikMoore} How do you get around references to the ASP objects when you test from the command window?

[22:40] {MikeHelland} What are your choices in the VFP 5 Build Diaolg, Simon?

[22:40] {DenisChasse} Simon: The build button is on the project manager.

[22:40] {MikeHelland} Well, like I said, if I use that way, I can't, so I simply prototpye the COM instead of do it all.

[22:40] {SimonGaudiuso} Build ole dll

[22:40] {MikeHelland} Thats the one Simon.

[22:41] {MikeHelland} Unless you've got a solution for us?

[22:41] {MikeHelland} Ok, now, that should get you going on ASP and using it with VFP.

[22:42] {DenisChasse} Thanks a lot Mike.

[22:42] {Evan Delay} Fantastic!

[22:42] {MikeHelland} THere is a great article at www.west-wind.com for more info.

[22:42] {ErikMoore} Well, if you wrap all of your Write calls in a method in your COM class, you can check for the availability of the ASP object before calling it, and alternatively write the output to the screen.

[22:42] {MikeHelland} Yep, that works Erik.

[22:42] {MarkusVoellmy} Thanks Mike

[22:42] {Evan Delay} Everyone watch the wiki for upcoming lectures. WednesdayNightLectures

[22:42] {MikeHelland} If you are looking for the ASP Object Model, I have a URL: StarDeveloper.com See the ASP 3.0 Object Model.

[22:43] {MikeHelland} Also, there is a great site full of links at www.asp101.com.

[22:43] {ErikMoore} www.15seconds.com

[22:44] {MikeHelland} Also, and a parting gift, at the bottom of this page there are some links that include the files you need to create a completely datadriven web site with ASP and VFP using DBFs.

[22:45] {MikeHelland} And the whole project is at the UniversalThread in the Internet Forum.

[22:45] {MikeHelland} Under ASP, you should see mhASPSite. You can use that to get you going.

[22:47] {MikeHelland} I'm not big on DCOM, to be honest, but you don't have to load all of VFP to run an VFP COM on a computer.

[22:55] {MikeHelland} The first time I read about that OnStartPage() method I was amazed at what it would do, If anyone else thought like me.

[22:55] {ErikMoore} MH, you can also get references to the ASP object through MTXAs.AppServer.1

[22:56] {ErikMoore} oCTX = oMTX.GetObjectContext()

[22:56] {ErikMoore} oResponse = oCTX.Item("Reponse")

[22:57] {MarkusVoellmy} Erik what's MTX ?

[22:57] {ErikMoore} The Microsoft Transaction Server context server... it works eve if the COM objectr is not hosted in MTS.

[22:58] {MarkusVoellmy} Aha then should I have that too, but I havent worked with MTS so far.

[22:59] {ErikMoore} The code I just posted is all you need: oMTX = CREATEOBJECT("MTXAs.AppServer.1"), but it's not really any easier than the OnStartPage method.

[22:59] {MarkusVoellmy} I'll give that a try later.

[23:04] {MikeHelland} Nadya, just look at my ASPSite File MhAspSite.zip, and you should be off and running with that.


See also: TemporaryRemakeOfTopicASPandVFP
Contributors: MikeHelland Evan Delay CindyWinegarden
CategoryTraining CategoryWednesdayNightLectures
( Topic last updated: 2000.09.11 06:55:51 AM )