Joseph Robidoux
Joseph Robidoux

Reputation: 351

vb.net convert value to string

Not sure how to do this, here is my code

 Dim oWeb As New System.Net.WebClient()

    oWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

    Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes("username=username&password=password")
    Dim bytRetData As Byte() = oWeb.UploadData("https://www.website.com", "POST", bytArguments)
    MsgBox(oWeb.ResponseHeaders.GetValues(2))

Im attempting to get the cookies saved then use it for another post data i want to do, but I keep getting logged off in like 1 second.

The error is

Argument 'Prompt' cannot be converted to type 'String'.

for the message box

Upvotes: 1

Views: 4077

Answers (1)

Adriaan Stander
Adriaan Stander

Reputation: 166326

The problem is that the GetValues returns an array of strings, which the MessageBox has trouble displaying.

When I change the line to

MsgBox(String.Join(",", oWeb.ResponseHeaders.GetValues(2)))

It works, so you need to decide how you wish to concatenate the string array that is being returned.

Upvotes: 2

Related Questions