httpwebresponse

Writing cookies from CookieContainer to the IE cookie store

我与影子孤独终老i 提交于 2019-12-21 02:47:14
问题 I want to navigate to a page in a web app from a desktop app. "No problem", I hear you say, "just fire up the default browser with the correct URL". However, the web app uses ASP.NET Forms Authentication, and the users don't want to see the login page because they have already authenticated with the same credentials in the desktop app. That sounds simple enough, all I have to do is emit an HTTP POST from the desktop app with that fakes the postback from the web app's login page. The web app

HttpWebResponse with MJPEG and multipart/x-mixed-replace; boundary=--myboundary response content type from security camera not working

帅比萌擦擦* 提交于 2019-12-20 23:19:11
问题 I have an ASP.NET application that I need to show a video feed from a security camera. The video feed has a content type of 'multipart/x-mixed-replace; boundary=--myboundary' with the image data between the boundaries. I need assistance with passing that stream of data through to my page so that the client side plugin I have can consume the stream just as it would if I browsed to the camera's web interface directly. The following code does not work: //Get response data byte[] data =

HttpWebResponse won't scale for concurrent outbound requests

蹲街弑〆低调 提交于 2019-12-20 10:37:19
问题 I have an ASP.NET 3.5 server application written in C#. It makes outbound requests to a REST API using HttpWebRequest and HttpWebResponse. I have setup a test application to send these requests on separate threads (to vaguely mimic concurrency against the server). Please note this is more of a Mono/Environment question than a code question; so please keep in mind that the code below is not verbatim; just a cut/paste of the functional bits. Here is some pseudo-code: // threaded client piece

Why am I getting, “Unable to connect to the remote server”?

白昼怎懂夜的黑 提交于 2019-12-20 05:47:22
问题 This err msg is the next one I get after resolving “NotSupportedException” as noted here I don't even reach the break point in the server code (set on the first line of the method that should be getting called). This is the relevant server code: [Route("api/PlatypusItems/PostArgsAndXMLFileAsStr")] public async void PostArgsAndXMLFileAsStr([FromBody] string stringifiedXML, string serialNum, string siteNum) { string beginningInvoiceNum = string.Empty; // <= Breakpoint on this line string

How can I safely loop until there is nothing more to do without using a “placeholder” while conditon?

岁酱吖の 提交于 2019-12-20 04:07:20
问题 In order to call my Web API method until no more data is returned (I'm fetching it in batches, to keep each result set small, due to the 98-lb-weakling persona of the client (Windows CE handheld device)), I'm using this code: while (moreRecordsExist) { redemptionsList.redemptions.Clear(); string uri = String.Format("http://platypus:28642/api/Redemptions/{0}/{1}", lastIdFetched, RECORDS_TO_FETCH); var webRequest = (HttpWebRequest)WebRequest.Create(uri); webRequest.Method = "GET"; using (var

How to display HTTP 401 basic authentication dialog

点点圈 提交于 2019-12-19 11:49:24
问题 I am new to web development. I have Android application that hosts some web pages using HTTPServer. I am using Netty to decode/encode request/responses. Now, I want to display basic authentication dialog when someone navigates to the my webpage. Something like this: Can I get some pointers ? Is it something HTTP built in functionality, any RFC ? Do I need to write some java script ? Any help would be great. 回答1: You just need to send the appropriate headers when a client requests a resource

HttpWebRequest and Set-Cookie header in response not parsed (WP7)

孤街浪徒 提交于 2019-12-19 03:22:29
问题 I am trying to get the header "Set-Cookie" or access the cookie container, but the Set-Cookie header is not available. The cookie is in the response header, but it's not there in the client request object. I am registering the ClientHttp stack using bool httpResult = WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp); Here's the response: HTTP/1.1 200 OK Content-Type: application/xml; charset=utf-8 Connection: keep-alive Status: 200 X-Powered-By: Phusion Passenger (mod_rails

HttpWebRequest POST and Cookies

时光毁灭记忆、已成空白 提交于 2019-12-18 18:23:11
问题 Hi am trying to make an application that post data to a joomla login page but the only thing i get back is cookies is not enabled. Function GetPage(ByVal Url As String) As String Dim CookieJar As New Net.CookieContainer Dim enc As Encoding = Encoding.GetEncoding(1252) Dim Data As Byte() = Nothing Dim PostData As String = "" If InStr(Url, "?") <> 0 Then PostData = Url.Substring(InStr(Url, "?")) Url = Replace(Url, PostData, "") Url = Url.TrimEnd("?"c) Data = enc.GetBytes(PostData) End If Dim

C# How to set HttpClient Keep-Alive to false

我只是一个虾纸丫 提交于 2019-12-18 11:45:12
问题 I had a low performance problem with HTTP requests on .NET. The HTTP GET request to a REST API on the localhost took about 500 ms to complete. I spent a lot of time to fix it. I have tried many ways: HttpClient , HttpWebRequest , WebClient and RestSharp . None of them work. Most solutions on the Internet said to set Proxy parameter to null but it still won't work faster. The only way I found to reduce this time is to set the Keep-Alive parameter of request to false: HttpWebRequest request =

HttpWebResponse: closing the stream

喜你入骨 提交于 2019-12-18 08:59:05
问题 I'm getting the response from an HttpWebRequest (using a modified version Jeff Richter's CCR wrappers), then inspecting a few of the headers in order to decide whether or not to continue the download. Sometimes I might not want to continue, so I consequently issue response.Close and request.Abort. Is it necessary to issue GetResponseStream then to close the stream, or is this implicit when one calls response.Close? After issuing GetResponse, the docs state: You must call the Close method to