webrequest

Adding multiple files to a WebRequest

Is there a way to add multiple files to a WebRequest to simulate the selection of multiple files by an enduser? ...

What are valid values for the MediaType Property on a HttpWebRequest

What are valid values for the MediaType Property on a HttpWebRequest? I want to do something like this: Dim url As String = HttpContext.Current.Request.Url.AbsoluteUri Dim req As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create(New Uri(url)), System.Net.HttpWebRequest) ' Add the current authentication cookie to the r...

Do all web requests contain the requestor's IP?

Am I able to depend on a requestor's IP coming through on all web requests? I have an asp.net application and I'd like to use the IP to identify unauthenticated visitors. I don't really care if the IP is unique as long as there is something there so that I don't get an empty value. If not I guess I would have to handle the case where ...

.Net: How to simulate and measure a full web request?

I’m trying to measure a request with WebRequest, But I’m getting significant smaller results then measuring with FireBug. I guessing it’s because some content like Images and CSS isn’t included. Is there a way to measure a full web request? My code: public string GetPageHtmlTime(string strUrl) { WebRequest reques...

How to set client name and referrer in the Post WebRequest in C#?

How to set client name and referrer in the Post WebRequest in C#? ...

Handling Redirection in .NET WebRequest

I'm behind a firewall that asks me to enter credentials before letting me access internet. So my first http request is intercepted and then redirected to a secure server that prompts me to enter my credentials, however the server certificate is not valid and hence, my request.getResponse fails with the exception message: "the underlying ...

Use WebRequest localy causes exceptions

Hello ! Right now I am working with my first Windows Mobile project and I have an odd problem.. I am using WebRequest to download some images from Internet - on my mobile it works but in debugger I have socket exceptions. string url = "http://new.meteo.pl/um/metco/mgram_pict.php?ntype=0u&fdate=2010011006&row=381&col=199&...

What is the equivalent of ASP.NET's WebRequest in php?

What is the equivalent of ASP.NET's WebRequest in php? ...

Uploading an image using C# and WebRequest?

Here is the working code in Python (using cURL): #!/usr/bin/python import pycurl c = pycurl.Curl() values = [ ("key", "YOUR_API_KEY"), ("image", (c.FORM_FILE, "file.png"))] # OR: ("image", "http://example.com/example.jpg"))] # OR: ("image", "BASE64_ENCODED_STRING"))] c.setopt(c.URL, "http://imgur.com/api/u...

Detect every request to server using PHP or javascript

Is it possible to get every request to server using Javascript or PHP if javascript not possible ? Thx for helping me... ...

Creating WPF BitmapImage from MemoryStream png, gif

Hi I am having some trouble creating a BitmapImage from a MemoryStream from png and gif bytes obtained from a web request. The bytes seem to be downloaded fine and the BitmapImage object is created without issue however the image is not actually rendering on my UI. The problem only occurs when the downloaded image is of type png or gif ...

How to get json response using system.net.webrequest in c#?

I need to get json data from an external domain. I used webrequest to get the response from a website. heres the code: var request = WebRequest.Create(url); string text; var response = (HttpWebResponse) request.GetResponse(); using (var sr = new StreamReader(response.GetResponseStream())) { text = sr.ReadToEnd(); ...

How to properly catch a 404 error in .NET

I would like to know the proper way to catch a 404 error with c# asp.net here is the code I'm using HttpWebRequest request = (HttpWebRequest) WebRequest.Create(String.Format("http://www.gravatar.com/avatar/{0}?d=404", hashe)); // execute the request try { //TODO: test for good connectivity first //So it will not update the whol...

ASP - running in localhost - unable to reach internet

I have an ASP MVC controller action. I'm trying to make a web request public ActionResult Index() { WebRequest request = HttpWebRequest.Create("http://www.some-internet-address.com"); WebResponse response = request.GetResponse(); string str = response.ToString(); }` I get a "WebException occured" the remote name could not be...

Silverlight WebRequest fails with "The URI prefix is not recognized"

I have a silverlight library that is supposed to get make a web service request and receive an xml response: Uri uri = new Uri("http://some_server:51306/getStuff.xml?id=14"); WebRequest request = WebRequest.Create(uri); However, WebRequest.Create(uri) fails with the exception "The URI prefix is not recognized". Not...

What is the best way of pulling json data in terms of performance?

Currently I am using HttpWebRequest to pull json data from an external site, and the performance was not good. Is wcf much better? I need expert advice on this.. ...

xmlrpc and System.Net.WebException .net 3.5 c#

Hi, I use CookComputing.XmlRpc; Trying to connect to trac using some requests but I get this: System.Net.WebExceptionStatus.ReceiveFailure {"The underlying connection was closed: An unexpected error occurred on a receive."} {"Unable to read data from the transport connection: An existing connection was forcibly ...

Webrequest sudenly stops working

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(baseurl + url); req.Timeout = 1000 * 10; HttpWebResponse response = (HttpWebResponse)req.GetResponse(); Stream str = response.GetResponseStream(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.Load(str); response.Close(); string imgurl = doc.DocumentN...

Posting small bits of data in VB.NET

Is there another way to easily make a POST request in .NET other than the WebRequest class? I have a very, VERY small piece of data I need to post: password=theword ...but WebRequest randomly, and I mean randomly, drops the data when posting to my server. I've tested it by using a chunk of code from my server that dumps the reque...

Using .NET to Post a file to Server HttpWebRequest or WebClient

Okay so here is the deal. As the question states, I'm trying to POST a file to a webserver and am having a few issues. I've tried posting this same file to the same webserver using Curl.exe and have had no issues. I've posted the flags I used with curl just incase they might point out any potential reasons why I'm having trouble with ...