Click here to Skip to main content
15,843,962 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionAll digits in string after W Pin
Dennis B. Muth6-Jul-23 20:41
Dennis B. Muth6-Jul-23 20:41 
AnswerRe: All digits in string after W Pin
Richard MacCutchan6-Jul-23 23:01
mveRichard MacCutchan6-Jul-23 23:01 
AnswerRe: All digits in string after W Pin
Richard Deeming6-Jul-23 23:01
mveRichard Deeming6-Jul-23 23:01 
GeneralRe: All digits in string after W Pin
jschell7-Jul-23 12:49
jschell7-Jul-23 12:49 
GeneralRe: All digits in string after W Pin
Richard Deeming9-Jul-23 22:16
mveRichard Deeming9-Jul-23 22:16 
GeneralRe: All digits in string after W Pin
jschell10-Jul-23 4:34
jschell10-Jul-23 4:34 
QuestionCURL POST request in VB.NET (json) Pin
Member 118569042-Jul-23 21:02
Member 118569042-Jul-23 21:02 
AnswerRe: CURL POST request in VB.NET (json) Pin
Andre Oosthuizen3-Jul-23 1:38
mveAndre Oosthuizen3-Jul-23 1:38 
In your CURL command, you are using the '-u' option to provide the username and token as a basic authentication header. In your VB.NET code, you're attempting to encode the credentials manually. Make sure that 'myUsername' has the correct username and token values, and try using the Credentials property of the 'WebRequest' object instead of manually adding the header -
request.Credentials = New NetworkCredential(txtUsername.Text.Trim, txtApiKey.Text.Trim)


The JSON data you're sending in the CURL command needs to be properly serialized before sending it, we use Newtonsoft.Json, not sure if it will help in your situation, if so you can use it where you create an anonymous type to represent the JSON structure and then serializes it using 'JsonConvert.SerializeObject()' -
Imports Newtonsoft.Json

Dim domainData As New With {
    .domain = New With {
        .domainName = "example.org"
    },
    .purchasePrice = 12.99
}

Dim data As String = JsonConvert.SerializeObject(domainData)


You need to close the request stream before sending the request -
request.GetRequestStream.Close()


Instead of directly displaying returned responses in a message box, you can return the status codes and any error messages further by using -
Dim statusCode As Integer = CType(myResp, HttpWebResponse).StatusCode
Dim responseText As String = String.Empty

If statusCode = HttpStatusCode.OK Then
    Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
    responseText = myreader.ReadToEnd()
End If

MsgBox(responseText)


I hope any of these suggestions help.
GeneralRe: CURL POST request in VB.NET (json) Pin
Member 118569043-Jul-23 23:37
Member 118569043-Jul-23 23:37 
GeneralRe: CURL POST request in VB.NET (json) Pin
Andre Oosthuizen4-Jul-23 0:22
mveAndre Oosthuizen4-Jul-23 0:22 
Questionrecord device!! Pin
Member Alienoiz19-Jun-23 7:31
Member Alienoiz19-Jun-23 7:31 
AnswerRe: record device!! Pin
Richard MacCutchan19-Jun-23 7:50
mveRichard MacCutchan19-Jun-23 7:50 
GeneralRe: record device!! Pin
Member Alienoiz19-Jun-23 8:08
Member Alienoiz19-Jun-23 8:08 
GeneralRe: record device!! Pin
Member Alienoiz19-Jun-23 9:30
Member Alienoiz19-Jun-23 9:30 
GeneralRe: record device!! Pin
Richard MacCutchan19-Jun-23 10:12
mveRichard MacCutchan19-Jun-23 10:12 
GeneralRe: record device!! Pin
Member Alienoiz19-Jun-23 10:34
Member Alienoiz19-Jun-23 10:34 
AnswerRe: record device!! Pin
Ralf Meier20-Jun-23 5:05
professionalRalf Meier20-Jun-23 5:05 
QuestionListbox Highlight color! Pin
Member Alienoiz18-Jun-23 6:26
Member Alienoiz18-Jun-23 6:26 
AnswerRe: Listbox Highlight color! Pin
Richard MacCutchan18-Jun-23 6:40
mveRichard MacCutchan18-Jun-23 6:40 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 7:00
Member Alienoiz18-Jun-23 7:00 
GeneralRe: Listbox Highlight color! Pin
Richard MacCutchan18-Jun-23 7:39
mveRichard MacCutchan18-Jun-23 7:39 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 7:49
Member Alienoiz18-Jun-23 7:49 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 8:08
Member Alienoiz18-Jun-23 8:08 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 8:47
Member Alienoiz18-Jun-23 8:47 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 9:41
Member Alienoiz18-Jun-23 9:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.