I am having a horrible time right now with INET. I need some assistance if someone can help me. I am writing a program in VB6 using INET controls to take a file and post the file up to a web service using HTTP POST protocol. The server on the opposite side is returning a response to me that I need to parse out but I can't get to a point where I am getting a response. Here is my code that I am using:


Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()

RunDir = App.Path & "/"

UserID = Text1(3).Text
Password = Text1(4).Text

Data = ""
If Dir(RunDir & "file.AL3") <> "" Then
Open (RunDir & "file.AL3") For Input As #1
Do Until EOF(1)
Line Input #1, Al3Input
Data = Data & Input
Loop
Close #1
Else
Missingfile = "Missing file.AL3 File"
MsgBox Missingfile, vbOKOnly, "File Pass error"
End If

Call DataEncode(Data)

Node = "%3CData%3E" & Data & "%3C%2FData%3E"

strURL = "https://sitepostingto.asp"

InetInfo = ""
InetInfo = InetInfo & "xmldata="
InetInfo = InetInfo & "%3CUpLoadRequest%3E"
InetInfo = InetInfo & Node
InetInfo = InetInfo & "%3CUserId%3E" & UserID & "%3C%2FUserId%3E"
InetInfo = InetInfo & "%3CUserPswd%3E" & Password & "%3C%2FUserPswd%3E"
InetInfo = InetInfo & "%3C%2FUpLoadRequest%3E"

InetHead = "Content-Type: application/x-www-form-urlencoded; charset=utf-8" & vbCrLf & vbCrLf

DoEvents

Inet1.Cancel
Inet1.AccessType = icUseDefault
Inet1.Protocol = icHTTP

frmResult.Visible = True
frmLoad.Visible = False


Inet1.URL = strURL
Inet1.Execute Inet1.URL, "POST", InetInfo, InetHead

End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)

Select Case State
Case icConnecting
Case icConnected
Case icRequesting
Case icRequestSent
Case icReceivingResponse
Case icResponseReceived

Case icResponseCompleted

Dim strTemp As String
strTemp = Inet1.GetChunk(512)

strTemp = Trim(strTemp)
If InStr(1, strTemp, "0:") Then
MsgBox "error: " & strTemp
Else
MsgBox strTemp
End If

Case icError
frmResult.Label1.Caption = "Error " & Inet1.ResponseCode & " " & Inet1.ResponseInfo
End Select
End
End Sub

Private Sub Form_Load()


End Sub

Public Function Encode(Data As String)

Data = Replace(Data, "$", "%24")
Data = Replace(Data, "&", "%26")
Data = Replace(Data, "+", "%2B")
Data = Replace(Data, ",", "%2C")
Data = Replace(Data, "/", "%2F")
Data = Replace(Data, ":", "%3A")
Data = Replace(Data, ";", "%3B")
Data = Replace(Data, "=", "%3D")
Data = Replace(Data, "?", "%3F")
Data = Replace(Data, "@", "%40")

End Function



The State response that I keep getting back is 5 or 8 but I cannot get a 12 at all. Any ideas are greatly appreciated and much needed.

Thank you for any help you can give.

Jayson