httpwebrequest

Why am I getting "(304) Not Modified" error on some links when using HttpWebRequest?

Hi, Any ideas why on some links that I try to access using HttpWebRequest I am getting "The remote server returned an error: (304) Not Modified." in the code? The code I'm using is from Jeff's post here. Note the concept of the code is a simple proxy server, so I'm pointing my browser at this locally running piece of code, which gets ...

HttpWebRequest issues

Hi, Im still having issues using HttpWebRequest. For some reason sometimes in my app the call just times out... HttpWebRequest req = null; req = (HttpWebRequest)WebRequest.CreateDefault(new Uri(aRequest)); req.PreAuthenticate = true; req.AllowAutoRedirect = true; req.KeepAlive = false; ..... resp = (HttpWebResponse)req.GetRespons...

clear cookie container in WebRequest

I'm using the WebRequest object to post data to a login page, then post data to a seperate page on the same site. I am instantiating a CookieContainer and assigning it to the WebRequest object so that the cookies are handled. The problem is that I do not want to retain the cookie after I post data to the other page. How can I delete t...

HttpListener - how do I send a WebException HTTP 304 "Not Modified" error back to browser?

Hi, How do I mimic a WebException 304 error back to browser if I am using HttpListener? That is I have received a request to my HttpListener, and then obtained the HttpListenerContext, then from this point how would I mimic/arrange for a HTTP "304 Not Modified" response to be effectively sent back to the browser via the HttpListenerCon...

How to get status code of a POST with Asp.Net HttpWebRequest

I'm trying to ping Google when my web site's sitemap is updated but I need to know which status code does Google or any other service returns. My code is below: HttpWebRequest rqst = (HttpWebRequest)WebRequest.Create("http://search.yahooapis.com/ping?sitemap=http%3a%2f%2fhasangursoy.com.tr%2fsitemap.xml"); rqst.Method = "POST"; rqst.Con...

How can I add an Array element into a Post rcp request

Hello community, I don't know how can I add array parameters in a post request. Until now I only needed something like method=method.name&param1=1.... My question is how can I add an Array in plain text? ...

Silverlight 4 - Download an html page from a different domain IN BROWSER?

I am trying to download a page using Silverlight 4 (http://google.com/) from a different domain than where the app is hosted. I'm simply curious if this is possible in the browser. I know I can do it out of the browser, as I tried it already, but trying it in the browser gives a security exception (understandable). I'd like to know ...

Best redirect code 3xx

Hi all, users can sign up to my site and get a standard url (username.teamgeisthq.com) from where they can access their content. They can also get a cleaner domain name like www.username.nl (same as username.teamgeisthq.com) to access their information. Google tells me that it s bad to have 2 urls pointing to the same content. i still ...

Writing file from HttpWebRequest periodically vs. after download finishes?

Right now I am using this code to download files (with a Range header). Most of the files are large, and it is running 99% of CPU currently as the file downloads. Is there any way that the file can be written periodically so that it does not remain in RAM constantly? private byte[] GetWebPageContent(string url, long start, long finish) ...

HttpWebRequest ReadWriteTimeout ignored in .NET; works in Mono

When writing data to a web server, my tests show HttpWebRequest.ReadWriteTimeout is ignored, contrary to the MSDN spec. For example if I set ReadWriteTimeout to 1 (=1 msec), call myRequestStream.Write() passing in a buffer that takes 10 seconds to transfer, it transfers successfully and never times out using .NET 3.5 SP1. The same tes...

Request time out error

Hi Today i came across strange problem whenever i try to pingging to my server works properly but whenever i send http reuest from browser the request time out happens. can anybody help me to resolve this issue. ...

Get website's server from IP address

I have a function that returns a website's server when you enter the url for the site: private string GetWebServer() { string server = string.Empty; //get URL string url = txtURL.Text.Trim().ToLower(); if (!url.StartsWith("http://") && !url.StartsWith("https://")) url = "http://" + url; HttpWebRequest reque...

Ajax request (from .NET) give me unexpected results

I wanted to learn a little more about web and .NET so i decided to write a program to download binaries, webpages and does a little ajax. The first download site i tried was too easy. So i went against uploading.com. It seemed good, no captcha, some ajax use required, you cant guess all the data, it was perfect. After 2hours of messing...

Get the parameters in Request

Hi All, How do I get the parameters that are available in the request Header? When I login to a site, I need to see the values that are available in the request header.Is it possible to get that information using any Addons? Can someone please help me to find this? Thanks in advance ...

Why is .NET Post different from CURL? broken?

NOTE: I fixed the user agent problem and i also added in an extra byte to match the content length. No luck however. I dont understand this. I ran this code below and the result json string was the link is expired (meaning invalid). However the curl code does the exact same thing and works. I either get the expected string with the url...

How to add parameters to a http post call?

hi all! I'm using the following lines of code to make an http post call NSData *imageData = UIImageJPEGRepresentation(image, 0.9); NSString *urlString = @"http://169.254.225.91:8888/upload.php"; // setting up the request object now NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL ...

User Agent doesn't work on POST data HttpWebRequest

This has been messing me up hard i have been trying to solve this problem and after writing a dummy app to check headers and pointing my code to it i notice HttpWebRequest will completely ignore my user agent when i POST data. Why? How do i solve this? ...

.Net System.Net.HttpWebRequest & Authentication Cookies

I would like to know if the following is possible: As part of the PageLoad of an ASP.Net page request: Use HttpWebRequest (POST) to make a request to a forms authentication webpage of a different web application Examine the response to see if the authentication succeeded (identifiable if an authentication cookie has been set) If it fa...

Posting data to a HttpHandler greater then ~29MB gives a 404 error

I am testing a HttpHandler that accepts XML. It works fine when a small amount of data is posted but if I post data larger then approx 29mb, I get a asp.net 404 Error. I am posting to the handler from another handler in the same project and I have tried 2 methods - 1. HttpWebRequest with "POST" 2. WebClient with UploadFile() and UploadD...

Sending POST variables through a PHP proxy for AJAX?

I've decided that using a PHP proxy for AJAX calls for a project is the best way to go - but I have a question regarding passing POST data through the proxy. As in - how to do it. Should I need to create a single variable in the javascript using alternate characters, then have the PHP proxy parse and modify the variable to reassemble...