Link to home
Start Free TrialLog in
Avatar of suicehockey44
suicehockey44

asked on

Does anybody know how I could logon with a UserName and pass programmtically with VB.NET to https://portal1.wregis.org/??

I know absolutely zilch javascript!!! Thanks in advance!!!
Avatar of ajnt__
ajnt__
Flag of United Kingdom of Great Britain and Northern Ireland image

Are you using a web browser control in a Windows Forms application or going through an ASP.Net web site?
You should use HttpWebRequest like this.
Dim URL As String = "https://portal1.wregis.org/mymodule/mypage.asp"
Dim myWebReq As HttpWebRequest = WebRequest.Create(URL)
 
Dim postData As String
postData += "myuserid=test"
postData += "&"
postData += "mypassword=test"
data = encoding.GetBytes(postData)
myWebReq.Method = "POST"
myWebReq.ContentType = "application/x-www-form-urlencoded"
myWebReq.ContentLength = data.Length
Dim myStream As Stream = myWebReq.GetRequestStream()
myStream.Write(data, 0, data.Length)
myStream.Close()
Dim myWebResp As HttpWebResponse
myWebResp = myWebReq.GetResponse

Open in new window

Avatar of suicehockey44
suicehockey44

ASKER

WinForms Webbrowser.  I really don't know any web stuff. I need to learn!
OK my solution does not work for a web browser ... hold on I will write one...
what is the line:
  data = encoding.GetBytes(postData)???

It says that System.Data is a namespace and cannot be used.
There is a line missing ... add this near the top of the code.
Dim data As Byte()

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ajnt__
ajnt__
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here's an example of using the framework.

When you have it downloaded then tell me and I'll give you a sample for that site, to login.
im instr1 As New ProcessingInstruction
        With instr1
            .InstructionType = ProcessingInstruction.eInstructionType.Navigate
            .InstructionValue = "https://www.paypal.com"
            .NextAction = ProcessingInstruction.eNextAction.WaitForDifferentPage
            .ElementIdentifierType = ProcessingInstruction.eIdentifierType.None
        End With
 
        Dim lstInstrs As New List(Of ProcessingInstruction)
        lstInstrs.Add(instr1)
 
        Dim instrs As New ProcessingRoutine
        instrs.ProcessingInstructions = lstInstrs
        instrs.RunRoutine(MyWebBrowser)

Open in new window