webrequest

Generic/unknown HTTP error when uploading files to a remote form

橙三吉。 提交于 2019-12-13 02:48:26
问题 I have an HTML page with a form for uploading files to SmartFile. Below is the piece of C# code that I am using to upload the files from my game in Unity to this url. WWWForm fileForm = new WWWForm(); string[] files = Directory.GetFiles(".", "*.txt"); fileForm.AddField("file", files[0]); WWW www = new WWW("https://file.ac/xySSFOicMMk", fileForm); Unfortunately it is leading to the below exception. What is wrong here? Connection error while sending analytics... Error:415 Unsupported Media Type

cURL to C# webrequest

若如初见. 提交于 2019-12-12 15:28:21
问题 I am trying to convert a cURL script to a C# script. If I want to POST an image do I have to convert it to a string? When I try running my script I get an exception from the target machine. Unfortunately I don't have access to see the code on the target machine. $ch = curl_init(); curl_setopt($ch,CURLOPT_HTTPHEADER,array("Expect:")); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; curl_setopt($ch, CURLOPT_USERPWD, "user:pwd"); curl_setopt($ch, CURLOPT_URL, 'http://192.168.1.105/upload

Run x number of web requests simultaneously

风格不统一 提交于 2019-12-12 09:54:16
问题 Our company has a web service which I want to send XML files (stored on my drive) via my own HTTPWebRequest client in C#. This already works. The web service supports 5 synchronuous requests at the same time (I get a response from the web service once the processing on the server is completed). Processing takes about 5 minutes for each request. Throwing too many requests (> 5) results in timeouts for my client. Also, this can lead to errors on the server side and incoherent data. Making

powershell curl and WebRequest both follow redirects

人盡茶涼 提交于 2019-12-12 08:54:59
问题 I was trying to figure out the status code returned by my webpage, which most certainly is 301 (moved permanently), according to curl on the Linux subsystem, but using curl or the WebRequest object on powershell, it returns 200 (OK). Why is this? 回答1: It is because .NET and PowerShell are following redirects by default but curl does not do this. The default value of HttpWebRequest.AllowAutoRedirect is true and Invoke-WebRequest's MaximumRedirection default value is 5. To turn off automatic

HTTP “date” header is missing in UnityWebRequest

◇◆丶佛笑我妖孽 提交于 2019-12-12 03:49:05
问题 I am working with Unity3d and am trying to send a GET request to an API that requires the Date request header. However UnityWebRequest does not send it automatically (I have checked with https://requestb.in/) and I cannot set it manually since "date" is one of the protected headers. UnityWebRequest www = UnityWebRequest.Get (fullURL); www.SetRequestHeader("Date", dateTimeString); yield return www.Send(); and I get the following error: ArgumentException: Cannot set Request Header Date - name

Data pass using POST method - WebRequest object

倖福魔咒の 提交于 2019-12-12 03:46:28
问题 I want to use POST method to pass data over web server. I want to retrieve data provided by web server in JSON format. I have used following code by referring Unity Manual. void Start () { StartCoroutine (LoadLoginInfo ()); } IEnumerator LoadLoginInfo () { Debug.Log("Load Login Info"); WWWForm form = new WWWForm (); form.AddField ("username", "admin"); form.AddField ("password", "Admin123#"); UnityWebRequest www = UnityWebRequest.Post (url, form); yield return www.Send(); if (www.isError) {

C#: How to invoke a click in a httpwebrequest?

牧云@^-^@ 提交于 2019-12-12 02:13:30
问题 I want to invoke the click on a page where you fill data too. I tried doing it with two httpwebrequests where one is for the page and one is where it transfers the session information and makes an account on the site which is the goal of my program. Everytime I tried to do it with two webrequests a certain field wasnt filled in but when I did it with one everything was filled out. So basically is it possible to invoke a click on a page with one httpwebrequest? 来源: https://stackoverflow.com

How can I make a local file as body of an HttpWebRequest? [duplicate]

∥☆過路亽.° 提交于 2019-12-12 01:53:02
问题 This question already has an answer here : Uploading zip file with POST/httpwebrequest in C# (1 answer) Closed 4 years ago . For example: I have to post data according to this reference They ask to post a request with a local file as the body. The curl they suggest is: curl -i --data-binary @test.mp3 http://developer.doreso.com/api/v1 But how can I do the same in c#? 回答1: Try using HttpWebRequest class and send file in a multipart/form-data request. Here is a sample code that you may use with

Is it possible to catch requests from another extension?

北城以北 提交于 2019-12-12 01:52:55
问题 In my extension I use chrome.webRequest to catch requests from any web pages and it works like a charm. But I can not catch any requests initialized from another extension. My manifest: "permissions": [ "tabs", "webRequest", "webRequestBlocking", "<all_urls>" ], background.js: chrome.webRequest.onBeforeRequest.addListener(function (data) { console.log('catched', data); }, {urls: ['<all_urls>']}); Tests: open tab with http://google.com: catched https://www.google.com/ open extension console

How to use WebRequest in c#

陌路散爱 提交于 2019-12-12 01:12:53
问题 I'am trying to use example api call in below link please check link http://sendloop.com/help/article/api-001/getting-started My account is "code5" so i tried 2 codes to get systemDate. 1. Code var request = WebRequest.Create("http://code5.sendloop.com/api/v3/System.SystemDate.Get/json"); request.ContentType = "application/json; charset=utf-8"; string text; var response = (HttpWebResponse)request.GetResponse(); using (var sr = new StreamReader(response.GetResponseStream())) { text = sr