Convert a CURL command into ASP.NET -


i have simple requirement of uploading .csv file on server. need convert below curl command asp.net:

curl -k -3 -vvv -h "accept: application/json" -x post --form "file=@xyz.csv" "https://myurl.com/lists.json?auth_token=xxxxxxxxx" 

i tried as:

webrequest request = webrequest.create("https://myurl.com/lists.json?auth_token=xxxxxxxxx"); webresponse response = request.getresponse(); response.write(((httpwebresponse)response).statusdescription);  stream datastream = response.getresponsestream();  streamreader reader = new streamreader(datastream);  string responsefromserver = reader.readtoend();  lblmsg.text = responsefromserver;  reader.close();  response.close(); 

but it's throwing error: system.net.webexception: operation has timed out

line 18: webresponse response = request.getresponse();

i not aware of how pass file name (xyz.csv) , other parameters such -vvv or -3 or -h while running command through asp.net.

any appreciated.

thanks,

kishori r.


Comments