httpwebrequest

using JSON-Framework to prepare a json object to post via HTTP Request Objective-C

I am successfully using the json-framework to do GET HttpRequests. Does anyone have code to prepare a json object and do a POST HTTP Request? If so, can you please share some sample objective-c code. Thanks ...

Generating a JSON payload for POST HTTP request in Objective-C

Does anyone have any sample code to create a JSON payload to be sent as a HTTP POST Request in Objective-C? An example of the json payload I am looking to generate looks like: {__metadata:{\"Uri\":\"/NewLoc/\", \"Type\":\"Location.NewLoc\"}, \"LocID\":\"100006\", \"latitude\": \"40.123456\", \"longitude\": \"-65.876543\", \"VisitDate\":...

Why my httpwebrequest post to myhandler.ashx is rejected with status code 401

I've already written an HTTPHandler that gets POSTed from a ColdFusion page and it works successfully; now, I am trying to write a web application in ASP.NET so I can post a form to the .ashx handler from an .aspx page. Application Trace (trace.axd) shows the following as my last 3 entries: 2 8/14/2009 1:53:56 PM /Default.aspx 2...

How to login to wordpress programmatically?

I need to perform some action in wordpress admin panel programmatically but can't manage how to login to Wordpress using C# and HttpWebRequest. Here is what I do: private void button1_Click(object sender, EventArgs e) { string url = "http://localhost/wordpress/wp-login.php"; HttpWebRequest request = (Htt...

How to post data from a webform page to an HTTPHandler.ashx file ?

Please bear with a bit of background first... I have a web application project to support file transfer operations to vendor product backend. It's composed of 2 HTTPHandler files compiled into a website on a Win2003 server with IIS 6.0: UploadHandler.ashx DownloadHandler.ashx These files get "POSTed to" from a ColdFusion website tha...

How do I get the MIME type of a file being requested in ASP.NET C#?

I would like to handle requests differently depending upon the MIME type. For example, I have PDF's, images and other media files that I would like to prohibit access to based on their respective MIME types. Any ideas on how to do this? Thanks for the help. I should also note that accessing the Windows registry is not an option for my a...

Stream sound from internet / server (and passing to nAudio soundplayer)

Hi, I'm trying to create a sound application, somewhat like Spotify using nAudio open source library. The application is only intended as a personal archive of my own song ideas. Most functionality works great but the WaveChannel32(New WaveFileReader) doesn't support URLs it seems. Now, the sound files themselves lie in a folder on a ...

Terminate Web Request Early (C#)

As part of a suite of integration tests I am writing, I want to assert that my server behaves correctly when a client HTTP request terminates early, before all the response data has been sent. Is it possible to create an HTTP request and terminate it after receiving just a few bytes of data in C#? ...

Simulate Incorrect Content-Length Headers for HTTP in C#

We are building a comprehensive integration test framework in C# for our application which exists on top of HTTP using IIS7 to host our applications. As part of our integration tests we want to test incoming requests which will result in EndOfStreamExceptions ("Unable to read beyond end of stream") that occur when a client sends up a HT...

Getting Http Status code number (200, 301, 404, etc.) from HttpWebRequest and HttpWebResponse

I am trying to get the HTTP status code number from the HttpWebResponse object returned from a HttpWebRequest. I was hoping to get the actual numbers (200, 301,302, 404, etc.) rather than the text description. ("Ok", "MovedPermanently", etc.) Is the number buried in a property somewhere in the response object? Any ideas other than cr...

How to bind an event to the group of links in AHAH-requested HTML

Hi all! I have an AHAH-requested HTML, like: <table> <tr> <td>...</td> <td><img src="..." onClick="get_next_ahah(sell####)" id="sell####"/></td> </tr> <tr> <td>...</td> <td><img src="..." onClick="get_next_ahah(sell####)" id="sell####"/></td> </tr> ... and so on where #### - numerical IDs from DB. How can I replace th...

HttpWebRequest or WebRequest - Resume Download ASP.NET

I would like to know if there is a way to know if a server supports resume download functionallity and if supported, how do I send a request to resume? I was looking for a solution where my ASP.NET page can do a download from a server to mine, something like "rapidleech" does today, but I would like to check if the server where i'm requ...

Firefox ignores Response.ContentType

I have the following code that's essentially "proxying" a file from one server to another. It works perfectly in IE, but Firefox seems to ignore the Content-Type header and always transmits the files (MP3s) as text/html. It's not a major issue, but I'd like to get it working correctly in all browsers, so can anyone assist? Also, if ther...

HttpWebRequest doesn't work in a web page

I have always used this code to donwload the html source from a web page: private string GetHtml(string url) { HttpWebRequest web = (HttpWebRequest)WebRequest.Create(url); web.Method = "GET"; WebResponse resp = web.GetResponse(); Stream istrm = resp.GetResponseStream(); StreamReader sr = new StreamReader(istrm); string html ...

Logging in to eBay using HttpWebRequest

I'm trying to log in to my eBay account using the following code: string signInURL = "https://signin.ebay.com/ws/eBayISAPI.dll?co_partnerid=2&amp;siteid=0&amp;UsingSSL=1"; string postData = String.Format("MfcISAPICommand=SignInWelcome&userid={0}&pass={1}", "username", "password"); string contentType = "application/x-www-form-urlencoded"...

How to send HTTP request in java?

I want to compose a HTTP request message in java and then want to send it to a HTTP WebServer. I also want the document content of the page recieved which I would have recieved if I sent the same HTTP request from a webpage. ...

Max number of concurrent HttpWebRequests

Hello I'm stress testing a web app and have set up a windows test program that spins up a number of threads and sends out a web request on each one. Problem is I get the following output: 01/09/09 11:34:04 Starting new HTTP request on 10 01/09/09 11:34:04 Starting new HTTP request on 11 01/09/09 11:34:04 Starting new HTTP request on 1...

When retrieving URL via HttpWebRequest, can I see the IP address of the destination server?

Suppose I am retrieving a url as follows: string url = "http://www.somesite.com/somepage.html" HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); Is there a way I can see the IP address of the destination url? Does it require a separate call? Thanks ...

HttpWebRequest.GetResponse throws WebException on HTTP 304

When a web server responds to HttpWebRequest.GetResponse() with HTTP 304 (Not Modified), GetResponse() thows a WebException, which is so very weird to me. Is this by design or am I missing something obvious here? ...

C# Post XML to URL not working

First of all, I am a WEB NOOB. Which probably explains this question. Anyway, when I use the web page test app to post xml to a url, everything works fine. Here is the pertinant code from the web page (i think): <form action="/gateway/xml" method="post" id="xml-test-form"> <textarea name="data"> {some xml is in here} </textar...