How do I access and ASP page via VB.net

  • Thread starter Thread starter Whitecrest
  • Start date Start date
W

Whitecrest

I have a stand alone VB.net application that (after pressing a button) I
would like the VB.net application to call an ASP page, passing
information to it in the query string.

www.somesite.com/registration.asp?id=1234

The ASP will enter the information in a database and return a "key" to
the VB.net application, which will write this "key" to the registry.

What I need to know is how can I make the vb.net application contact the
ASP page, and understand the results.

Thanks
 
Hi

Yesterday Nick Holmes, did supply this in the dotnet.general group in C#
code.
I am not sure if it is what you are looking for.

I translated it in VB.net
\\\
Dim myReg As Net.HttpWebRequest = _
DirectCast(Net.WebRequest.Create("www.somesite.com/registration.asp?id=1234"
), _
Net.HttpWebRequest)
Dim myResp As Net.HttpWebResponse = _
DirectCast(myReg.GetResponse(), Net.HttpWebResponse)
Dim myStream As IO.Stream = myResp.GetResponseStream()
Dim myreader As New IO.StreamReader(myStream)
Dim myPage As String = myreader.ReadToEnd()
myResp.Close()
///


You can try it, when all goes well than you have information from the page
in myPage.
The best would be mshtml, however for this I would just go for getting the
first point with an index of and then the last point from the string
searching the rigth tags and cut your string from it.

There are as well people who use regex solutions for this cutting.

I hope this helps?

When not reply, I think that we than we can use another solution.

Cor
 
* Whitecrest said:
I have a stand alone VB.net application that (after pressing a button) I
would like the VB.net application to call an ASP page, passing
information to it in the query string.

www.somesite.com/registration.asp?id=1234

The ASP will enter the information in a database and return a "key" to
the VB.net application, which will write this "key" to the registry.

What I need to know is how can I make the vb.net application contact the
ASP page, and understand the results.

\\\
Imports System.IO
Imports System.Net
..
..
..
Public Function LoadTextFile(ByVal Url As String) As String
Dim wrq As WebRequest = WebRequest.Create(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq.GetResponse(), HttpWebResponse)
Dim sr As StreamReader = _
New StreamReader(wrp.GetResponseStream)
Dim Text As String = sr.ReadToEnd()
sr.Close()
wrp.Close()
Return Text
End Function
..
..
..
Dim s As String = LoadTextFile("http://www.somesite.com/registration.asp?id=1234")
///
 
Back
Top