webrequest

Illegal Characters in Path Error When Downloading CSV File

霸气de小男生 提交于 2019-12-12 00:40:14
问题 I need download a CSV file and then read it. Here is my code: tickerValue = "goog" Dim strURL As String = "http://ichart.yahoo.com/table.csv?s=" & tickerValue Dim strBuffer As String = RequestWebData(strURL) Using streamReader = New StreamReader(strBuffer) Using reader = New CsvReader(streamReader) I keep getting this error: An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll Additional information: Illegal characters in path. What am I doing wrong? Additional

Unity3D C# WWW class: execute code after every request

ε祈祈猫儿з 提交于 2019-12-11 23:08:11
问题 I couldn't find any clues for this online as I suppose a lot of people have abandoned Unity's WWW class for complex stuff. I'm using the WWW class to talk to my REST API, and I need to find a way to execute some code after every request. (I need to check the response code and execute some default behaviour if the response is 401) Is there a simple way to achieve this? (I'm using coroutines to send the requests) Thanks in advance. Update: Current code sample Auth.cs: public IEnumerator Login

WebRequest will not pass headers when used from within ASP.NET MVC controller

半世苍凉 提交于 2019-12-11 19:58:04
问题 I have an ASP.NET MVC 4 project that when I make an http call using a webrequest, the headers will not pass. The same code in Linqpad I can set info in the headers such as AUTHORIZATION and it works fine (I can see the header values in Fiddler) However, when I do the same code from within my MCV controller then the headers do not pass. Its as if ASP.NET MVC is overriding my headers. Any suggestions? var client = WebRequest.Create(url); client.Headers.Add(String.Format("Authorization:{0}",

Show Progress of UnityWebRequest

瘦欲@ 提交于 2019-12-11 17:07:22
问题 I'm trying to download an assetbundle using Unity Web Request and show the progress, according to the documentation i need to capture a WebRequestAsyncOperation object to find the progress but i cannot find it I tried using AsyncOperation and UnityWebRequestAsyncOperation and my routine works with both, what is the difference of using one or another? here is my code: IEnumerator DownloadModel3D() { using (UnityWebRequest uwr = UnityWebRequest.GetAssetBundle(bundleURL,1,0)) { /

Wait for all requests to continue

会有一股神秘感。 提交于 2019-12-11 17:00:03
问题 Please, can this code be done async? I have problems because all requests must be terminated before the code can continue, I saw something about how wait an isolated request, but then i couldn't use the loop, I've been trying to solve this for a while, if anyone can help me it would e great. StartCoroutine(GetTexture()); IEnumerator GetTexture() { for (int i = 0; i < 10; i++) { string url = string.Format("https://galinha.webhost.com/img/{0}.jpg", words[i]); UnityWebRequest www =

Catching HttpWebRequest Timeout

霸气de小男生 提交于 2019-12-11 16:48:16
问题 public int loginEmail(string email, string password) { HttpWebRequest request = null; string responseStr = null; string Email = email; string Pass = password; UTF8Encoding encoding = new UTF8Encoding(); string postData = "PostData"; byte[] data = encoding.GetBytes(postData); request = (HttpWebRequest)WebRequest.Create("url"); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.AllowAutoRedirect = false; request.KeepAlive = false; request.Proxy = null;

Connect to Windows app with WebRequest

纵然是瞬间 提交于 2019-12-11 16:41:35
问题 Is it possible for a windows mobile phone to use WebRequest to connect to a windows client application. I mean an actual windows forms application. I want to use webrequest but the client application cannot be a web app or anything, it has to be a windows forms program. So, is it possible? Thanks 回答1: Possible, yes. Easy, or a good idea for that matter, no. If your WinForms app also opens up a Socket and listens for requests on port 80. Essentially you have to build a web server into your

How to dismiss a Lametric Nofitication using powershell

夙愿已清 提交于 2019-12-11 16:13:42
问题 This is a followup question to this comment about dismissing a notification on the Lametric clock. We use the Lametric clock to display notifications whenever a build fails. So far, someone would need to get up and physically press the button on the Lametric clock to dismiss the notification again. How can this be solved using powershell? 回答1: To solve this, we first made a GET request to get a list of notifications IDs in the queue of the Lametric clock: $request = @{uri = 'http://192.168.37

Stop a httpwebrequest?

耗尽温柔 提交于 2019-12-11 15:55:18
问题 I made a httpwebrequest in a sub. The form on my program has a start button which calls the sub. I want to add a Stop button to it to stop the httwebrequest if the user so chooses. How would I do this? 回答1: Call Abort on the HttpWebRequest. BEWARE that this might cause some strange behaviour... for example: depending on how you made the request and in what state it is this might lead to a deadlock. 回答2: You could use the HttpWebRequest.Abort() method to stop your HTTP request. Please see the

Reading xls stream with GetResponseStream and SpreadsheetDocument.Open

故事扮演 提交于 2019-12-11 12:23:38
问题 I want to read an xls from a server. I succeeded to download the file with the WebClient, but now I want to open it without saving the file. var request = WebRequest.Create(location); var response = request.GetResponse(); var stream = response.GetResponseStream(); var document = SpreadsheetDocument.Open(stream, false); if (stream != null) stream.Close(); My code stops on the SpreadsheetDocument.Open, it gives teh following error: Cannot operate on stream that does not support seeking. What am