Solved

vb6 talking to asp

Posted on 2006-06-14
7
287 Views
Last Modified: 2010-04-30
I have an asp page where there is a text box which I put in a number, do some work, then spit back another number.
It is a really crude valitdation thing that works pretty well.

I would like to be able to call the page in the background from a vb application and have the software read the number from the web.

So instead of someone going to my page, putting a number in a box, hitting submit, then copying and pasting the number back to the application, I would like to do it in the background.


I am using vb6.

How would I do this?
0
Comment
Question by:jackjohnson44
  • 4
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
donald9 earned 500 total points
ID: 16914728
Add this control to your project:
Microsoft Internet Controls

Drag the "WebBrowser" to your form.

Use this code to navigate to the page:

WebBrowser1.Navigate2 ("http://www.url.com/?i=" & variabletopass)

where variabletopass is the number you want to pass your ASP page.

Now, you need this subroutine

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    verinfo = WebBrowser1.Document.documentelement.innerHTML
    verinfo = Replace(lcase(verinfo), "<html>", "")
    verinfo = Replace(lcase(verinfo), "<body>", "")
    verinfo = Replace(lcase(verinfo), "</body>", "")
    verinfo = Replace(lcase(verinfo), "</html>", "")
    verinfo = Replace(lcase(verinfo), "</head>", "")
    verinfo = Replace(lcase(verinfo), "</body>", "")
    verinfo = Replace(lcase(verinfo), "<head>", "")
    verinfo = Replace(lcase(verinfo), "<body>", "")
    verinfo = Replace(lcase(verinfo), " ", "")
    verinfo = Replace(lcase(verinfo), Chr(10), "")
    verinfo = Replace(lcase(verinfo), Chr(13), "")
End Sub

Now, the "verinfo" variable will have just the number that was passed from your ASP page as long as the ASP page is ONLY wrighting out that number. If it is writing out more than just that number you want, either remove the other info, create another page, or use the replace code above to remove the extra info.

Also, be sure your ASP page is using request.querystring instead of request.form

Hope that helps. Let me know if you need more help / clarification.
0
 

Author Comment

by:jackjohnson44
ID: 16915415
is this .net?
0
 
LVL 1

Expert Comment

by:donald9
ID: 16915444
no. classic vb.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:jackjohnson44
ID: 16915483
Thanks

Should "WebBrowser1.Navigate2" and "WebBrowser1_NavigateComplete2" be the same?

WebBrowser1.Navigate2 ("http://www.url.com/?i=" & variabletopass)

Private Sub WebBrowser1_NavigateComplete2
0
 
LVL 1

Expert Comment

by:donald9
ID: 16915505
no. they are different. The first is calling a function of the WebBrowser control. The second is creating a subroutine.
0
 

Author Comment

by:jackjohnson44
ID: 16915552
so what calls the sub?
0
 
LVL 1

Expert Comment

by:donald9
ID: 16915744
when you call the navigation function and tell it to go to a web page the control automatically passes back information to your application and that sub routine is called without you having to do anything once the web page has finished loading.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now