Emulating Curl --user --insecure in c# -


i have following curl call works.

curl --insecure --user user@applicationname:password "https://someurl" 

i cannot life of me httpwebrequest emulate this.

currently trying

 var httpwebrequest = (httpwebrequest)webrequest.create("https://someurl);         httpwebrequest.contenttype = "application/json";         httpwebrequest.accept = "*/*";         httpwebrequest.method = "post";         httpwebrequest.headers["authorization"] = "basic " +    convert.tobase64string(encoding.ascii.getbytes("user@account:password")); 

i getting error authentication failed because remote party has closed transport stream

i guessing has curl command having insecure option cannot life of me see how in request.

do network restrictions/policies cannot download restsharp or other 3rd party libraries...

add line before doing request

system.net.servicepointmanager.servercertificatevalidationcallback = (obj, x509certificate, chain, errors) => true; 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -