httpwebrequest

calling external websites from silverlight

蹲街弑〆低调 提交于 2019-12-24 11:22:23
问题 I am writing a small silverlight app just to try silverlight. My idea is to make a small app that checks if websites are online. It works by the user inputting a URL and my app checks it uptime every 5 minutes. But when ever I do a webrequest I get the security exception below. Reading http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(VS.95).aspx it seems to indicate that silverlight doesn't allow crossdomain connection. So is there no way to make my idea work in silverlight?

Fire a (multi) curl request and don't wait for the response (PHP)

给你一囗甜甜゛ 提交于 2019-12-24 09:48:09
问题 I want to fire a set of PHP script (through multi_curl) and not wait for a response from the caller script (200 OK): I have an aggregator that runs searches on social media network APIs asking them for messages. When it gets a response it fires up another search for messages that were earlier (paging). This can take quite a long time and I don't want to make users wait for this to finish. I would like to be able to fire up a set of PHP scripts from one main script, if you will, in the

sending httpresponses in library file c#

孤者浪人 提交于 2019-12-24 07:25:20
问题 i used the following code to download the file folder in asp.net website are string path = @"E:\sample.zip"; FileInfo file = new FileInfo(path); int len = (int)file.Length, bytes; Response.ContentType = "text/html"; // Response.AddHeader "Content-Disposition", "attachment;filename=" + filename; Response.AppendHeader("content-length", len.ToString()); byte[] buffer = new byte[1024]; using(Stream stream = File.OpenRead(path)) { while (len > 0 && (bytes = stream.Read(buffer, 0, buffer.Length)) >

Amazon Login with Webrequest

荒凉一梦 提交于 2019-12-24 07:19:48
问题 So I'm in the process of making a personal program for myself (I've made a thread on it before) in which I make an Amazon recent items checker where I can just pull all my purchases and populate them in a listview on the form. up to this point I've been using a webbrowser, but that method is taking way to long. So I figured I would have a go with webrequests and try it that way, I've been trying and trying but I can't replicate the POST request to login to http://Amazon.com. Here's my code:

understand HttpWebRequest in keepAlive mode

徘徊边缘 提交于 2019-12-24 07:16:46
问题 i know that the topic has been discussed many times but I need to understand how to write code in the correct way. I use more times the same HttpWebRequest (to the same url) with protocol version HTTP 1.1. Method = "POST" KeepAlive = True But everytime i need to send a different request, and get a different response. (NB. This next code, it's not correct, and throw an exception) Private Sub SendHttpWebReq() Dim httpWebReq = CType(Net.WebRequest.Create("http://www.contoso.com/"), Net

How to issue PUT HttpWebRequest

寵の児 提交于 2019-12-24 07:02:39
问题 I'm trying to integrate with an API that requires a PUT to update data: Here's an example from them using curl: curl --request PUT \ --user-agent "Your Client Name/1.0" \ --header "Content-Type: application/xml" \ --data-binary '<order><status_id>10</status_id></order>' \ https://www.example.com/api/v2/orders/101 However, I'd need to use JSON (they support that as well) using .NET MVC 3. Any idea on how I can do that? I use the code below for GET successfully: Order obj = Call<Order>(url,

Throttle WebRequests

主宰稳场 提交于 2019-12-24 05:56:26
问题 I want to execute a bunch of WebRequests, but set a threshold on how many can be started simultaneously. I came across this LimitedConcurrencyTaskScheduler example and tried to utilize it like so scheduler = new LimitedConcurrencyLevelTaskScheduler(1); taskFactory = new TaskFactory(scheduler); ... private Task<WebResponse> GetThrottledWebResponse(WebRequest request) { return taskFactory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null); } However I noticed that

.Net client authentication setup using HttpWebRequest

ⅰ亾dé卋堺 提交于 2019-12-24 05:44:14
问题 This is more about how to get HttpWebRequest to work or even if HttpWebRequest is the right implementation. I've let my C# and .Net skill lapse the past few year, so I hope I can be forgiven for that. I trying to hit a secure web service that requires client authentication. I have four certs to hit this with. • Root Certificate • Intermediate Root Certificate • Device Certificate • Private Key The server is Java and these certs are in .jks form trustore and keystore. I pulled them into .pem

Machine-Specific HttpWebResponse Timeout

允我心安 提交于 2019-12-24 03:40:12
问题 I have a very odd machine-specific issue. On some machines, the code below works, on others it freezes until a timeout exception is thrown on by GetResponse() call. string url = "https://myserver/myimage.png"; System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => { return true; }); HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); req.Method = "GET"; req.AllowAutoRedirect = false; try { using (HttpWebResponse resp

How can I detect if a URL is redirected to another one?

这一生的挚爱 提交于 2019-12-24 03:19:33
问题 I use this code to make a 'GET' request to urls. var request = WebRequest.Create(uri) as HttpWebRequest; request.Method = "GET"; var response = request.GetResponse() as HttpWebResponse; var status = response.StatusCode; // returns HttpStatusCode.OK So, the probelem is when a url is redirected to another one, I can't detect it. For example; url is: http://site.com that redirects to http://www.site.com but when I make a request to http://site.com it returns a HttpStatusCode.OK for it -instead