webrequest

Poloniex C# Trading API webRequest comes back (403) Forbidden

荒凉一梦 提交于 2019-12-11 12:03:52
问题 I have my code down to the essentials for testing access, but am receiving the good old error(403) from the server, I have verified for double-sure I am using the correct API Key/Secret pair. My Code (C# via Unity 3D) is as follows: using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using System.Security.Cryptography; using System.IO; using System.Text; using System.Net; public class PolonScript : MonoBehaviour { public TextMesh OutputText; const

How to get plaintext from the response of a WebRequest class in C#

烈酒焚心 提交于 2019-12-11 11:23:34
问题 I want to get plain text using WebRequest class, just like what we get when we use webbrowser1.Document.Body.InnerText . I have tried the following code public string request_Resource() { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(myurl); Stream stream = request.GetResponse().GetResponseStream(); StreamReader sr = new StreamReader(stream); WebBrowser wb = new WebBrowser(); wb.DocumentText = sr.ReadToEnd(); return wb.Document.Body.InnerText; } when i execute this is get a

WebRequest will not pass headers

别说谁变了你拦得住时间么 提交于 2019-12-11 07:50:10
问题 i have trolled and tried everything, i have done this 100's of times before without issues but now im stumped. I simply want to pass header info from a webrequest. The client runs separately and connects to a wcf rest service. The service has this code which gets hit: HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Authorization, Origin, Content-Type, Accept, X-Requested-With"); The client has this: var client = WebRequest.Create(url); client.Method = type.ToString()

The remote server returned an error: (405) Method Not Allowed

▼魔方 西西 提交于 2019-12-11 05:59:05
问题 I want to use HttpWebRequest to post a file to the server: private void testUpload() { FileStream source = File.Open(@"C:\test.txt", FileMode.Open); var request = (HttpWebRequest)WebRequest.Create(new Uri("http://example.com/Project/")); request.Method = "POST"; request.BeginGetResponse(DataUploadCompleted, request); } private void DataUploadCompleted(IAsyncResult ar) { var request = (HttpWebRequest)ar.AsyncState; var response = request.EndGetResponse(ar); } I got this exception: The remote

Retrieve XDocument only when modified using Rx + WebRequest + XDocument.Load

狂风中的少年 提交于 2019-12-11 05:34:15
问题 I have the following two observables System.Net.WebRequest req = System.Net.HttpWebRequest.Create("http://test.com/data.xml"); req.Method = "HEAD"; var ob = Observable.FromAsyncPattern(req.BeginGetResponse, req.EndGetResponse); ob().Select(x => x).Select(x => x.Headers["Last-Modified"]).DistinctUntilChanged(x => x); Observable .Interval(TimeSpan.FromSeconds(1.0)) .Select(_ => XDocument.Load("http://test.com/data.xml")); I would like it that the XDocument observable is only executed when "last

How to pass an array via web-request

▼魔方 西西 提交于 2019-12-11 04:38:52
问题 Situation: We collect automatically many reports from some web services ( PowerShell script running every night), and every day in manual mode (drag and drop on web-form) this reports are loaded in our DB. Now our IT department gave us an API that can handle this job without user interaction. Problem: As was written in covering letter (about this API) it waits for reports[n] array with file. It can be done with PHP and curl: $report = 'report_20160825.{8302F59C-E1E4-410F-BE37-A24CCD7E515E}

Getting Image from the server while ignoring the file's case sensitivity

你离开我真会死。 提交于 2019-12-11 04:38:44
问题 How can i make my code to get image "_filename.JPG" not only "_filename.jpg"? string picUrl = "http://MyServer/" + _filename + ".jpg"; Image webImage = global::MyProject.Properties.Resources.ImageNotFound1; try { WebRequest requestPic = WebRequest.Create(picUrl); WebResponse responsePic = requestPic.GetResponse(); webImage = Image.FromStream(responsePic.GetResponseStream()); } 回答1: Case sensitivity is enforced by server - your client side code can't influence server's behavior. It is unusual

HttpWebRequest Server Unavailable 503 probleme

房东的猫 提交于 2019-12-11 04:04:04
问题 I originally used WebRequest and WebResponse to sent Http Post Messages. Always I got a response of "OK". The message I post is an XML signed with a certificate in the xml. The composition is this: C# service that is sending to a https website. HTTPS Website on another place that I cant say. HTTPS Local Website locally that is just receiving the messages I post locally and writing the results to a file. Just to simulate what the other website is getting. Local Website is signed with a self

HitBTC api POST request, C#

心已入冬 提交于 2019-12-11 02:52:01
问题 I know how to do a GET request, but POST does not work: public string Order() { var client = new RestClient("http://api.hitbtc.com"); var request = new RestRequest("/api/2/order", Method.POST); request.AddQueryParameter("nonce", GetNonce().ToString()); request.AddQueryParameter("apikey", HapiKey); // request.AddParameter("clientOrderId", ""); request.AddParameter("symbol", "BCNUSD"); request.AddParameter("side", "sell"); request.AddParameter("quantity", "10"); request.AddParameter("type",

MonoTouch auto proxy network credentials not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:16:23
问题 Trying to load some data off my server (xml data). I normally just use HttpWebRequest as I can set the utomaticDecompression to DecompressionMethods.GZip | DecompressionMethods.Deflate in order to use gzip compression of my data automatically. Recently a client has emailed me saying that it does not work from within his school. Sent out another copy of the app to him via TestFlightApp to get more debugging info from him and the app responds with a 407 auth error. Since then I have set up a