rp
asked on
Error on Credentials, converting c# to vb.net
Hi,
After converting c# to vb.net a piece of code i have an error on Credentials:
Dim httpReq As HttpWebRequest = CType(WebRequest.Create(New Uri(TokUri)), HttpWebRequest)
httpReq.Method = "POST"
httpReq.KeepAlive = True
httpReq.AllowAutoRedirect = True
httpReq.PreAuthenticate = False
Dim cred As Credentials = New Credentials() With {
.username = username,
.password = password
}
Visual studio not recognize Credentials and says "Type: Credentials is not dfined"
best regards
are you missing an import (using) like System.Net?
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Use the secure string function when storing passwords.
Do you need to create that object? You could directly assign it to your httpReq instance.
I have this working code:
I have this working code:
httpReq.Credentials = New NetworkCredential(username, password)