httpwebrequest

HttpWebRequest WebProxy problem - The connection was closed unexpectedly

时光怂恿深爱的人放手 提交于 2019-12-24 02:24:14
问题 I'm trying to make a HTTP request through an open SOCKS5 proxy. I have verified that the proxy works by setting it as a proxy for Firefox before setting it as the proxy in my C#.Net application by setting request.Proxy = new WebProxy(ip, port); However, on attempting to run the application and make my request I get an exception - System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly. I'm unsure what is causing this - the proxy seems to be open

HttpWebRequest is not sending all cookies

烂漫一生 提交于 2019-12-24 02:24:14
问题 I'm trying to have my application perform a login action on an external website. I use the following code: Dim enc As Encoding = Encoding.UTF8 Dim Data As Byte() = Nothing Dim req As HttpWebRequest req = CType(Net.WebRequest.Create(URL), Net.HttpWebRequest) req.Method = method req.CookieContainer = CookieJar req.AllowAutoRedirect = False If method = "POST" Then req.ContentType = "application/x-www-form-urlencoded" Data = enc.GetBytes(PostData) If Data.Length > 0 Then req.ContentLength = Data

Stream a WAV File From The Web In Silverlight 3

时间秒杀一切 提交于 2019-12-24 01:38:26
问题 I've managed to discover Gilles Khouzam's playback implementation for WAV files in Silverlight 3 and while that would be the majority of the battle, I'm stuck on a final detail: how do I pull a wav file from the web some place and then feed it into his WaveMediaStreamSource for playback? Here's the closest I've come: public MainControl() { // Required to initialize variables InitializeComponent(); PlayButton.Click += PlayButtonClicked; } private void PlayButtonClicked(object sender,

C# HttpWebRequest - Using Gzip Compression

…衆ロ難τιáo~ 提交于 2019-12-24 01:04:53
问题 I have a program which makes lots of HttpWebRequests, and I read about using gzip compression to speed up the downloading of the response data. I know what gzip is, and how it works, but I don't know how it works in C#. Let's say I have a simple GET request: HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://google.com"); request.Method = "GET"; WebResponse response = request.GetResponse(); How could I make the response data be compressed in gzip? How can I show the compressed

webrequests with Binding different IPs using BindIPEndPointDelegate does not result in multiple ServicePoints for same host in multi-thread

此生再无相见时 提交于 2019-12-24 00:54:34
问题 Category: Throughput Increment Scenario: Multiple HttpWebRequests need to be send through different ethernet adapters to the same host. Keys to Remember: Requests are going to same host. There is a built in limit on per-host basis as servicepoint. Number of simultaneous requests to a host can be leveraged by setting System.Net.ServicePointManager.DefaultConnectionLimit to 100 (for example), or by setting webRequest.ServicePoint.ConnectionLimit = 50 (say) for a webrequest objects with same uri

Is there away to force HttpWebRequest post data to be sent right away?

帅比萌擦擦* 提交于 2019-12-24 00:28:19
问题 Using Wireshark, Send POST data with HttpWebRequest , the data is being sent in a secondary packet instead of being applied to the primary packet and then sending secondary packets if need be. HttpWebRequest is sending only header information in the first packet and then POST data in the second packet. This is causing the HTTP Server to respond before the full HTTP request is received. Server is acting like an empty POST message even with the Content-Length being set in the header because no

Mono and WebRequest Speeds - A test

泄露秘密 提交于 2019-12-24 00:23:24
问题 In mono 4.6.2 / linux, I'm noticing huge differences between the speed wget can download files, vs webclient.DownloadString , so I made a little test to investigate. Why is wget significantly faster than C#? From my own experiments, it's faster to swallow the overhead of downloading using wget, reading in the files manually, and finally deleting the downloaded files, than simply using .DownloadString . Am I using the HttpWebRequest incorrectly? Update: On mono/linux, it would seem that using

String encoding problem on PdoStatement->bindParam()?

自作多情 提交于 2019-12-24 00:17:43
问题 I'm trying to perform a simple SELECT statement from a string taken from a $_REQUEST var but it seem my PDO statement doesn't like the string format, why? My $_REQUEST var contains a string like Hello+World , so I need to replace + with whitespaces to do my SELECT statement correctly. // the data returned is Hello+World $phrase = str_replace ("+", " ", $_REQUEST["my_data"]); $phrase_select = $connection->prepare ("SELECT data_field FROM my_table WHERE phrase = ':phrase'"); $phrase_select-

encoding issues with content in response from HttpWebRequest

谁说我不能喝 提交于 2019-12-24 00:15:14
问题 I am using a HttpWebRequest to read in a web page using the following code: var pageurl = new Uri(url, UriKind.Absolute); var request = (HttpWebRequest)WebRequest.Create(pageurl); request.Method = "GET"; request.AutomaticDecompression = DecompressionMethods.GZip; request.KeepAlive = false; request.ConnectionGroupName = Guid.NewGuid().ToString(); request.ServicePoint.Expect100Continue = false; request.Pipelined = false; request.MaximumResponseHeadersLength = 4; if (ignoreCertificateErrors) {

HttpWebRequest 401 with NTLM Authenticiation

瘦欲@ 提交于 2019-12-23 23:06:29
问题 I am having difficulties authenticating a HttpWebRequest to a webserver. The response I am receiving is simply a 401. I've made sure I set the credentials correctly on the C# side, and IIS is correctly set to allow NTLM authentication. I don't know if this matters, but he computer is not on the same domain as the the web server. I am sure the user/pass is correct but are there any other authorization settings needed to configure on the user? If I enable Basic authentication, and disable