httpwebrequest

How do you get a System.Web.HttpWebRequest object to use SSL 2.0?

I don't know if I have all the information needed to phrase this question well, so bear with me. I have a local web page (local meaning 192.168.*) that is protected with a self-signed SSL cert. I'm trying to access this page using a System.Net.HttpWebRequest object, but I'm running into a weird problem. If this page is accessed in Inte...

401 when POSTing using HttpWebRequest (yes I used Credentials)

I'm using HttpWebRequest to pull down XML, and POST data back to a 'WebService' and getting a 401 on the POST. When creating the requests I've added Credentials and now tried a credentials cache and setting PreAutenticate to True, still getting the 401! :( Watching the HTTP traffic on the router I set the get make an unauthenticated G...

Displaying Loading text while doing a WebRequest

I have a button on my webform. Clicking this button will do an HttpWebRequest during the onclick event handler. After the request we copy the response from the request into HttpContext.Current.Response and send that to the client. This web request can take a while (up to 5 seconds, since it's generating a report). During this time the u...

HttpWebRequest to SSL fails

I'm using this code, to make a request to a given URL: private static string GetWebRequestContent(string url) { string sid = String.Empty; HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); req.KeepAlive = false; using (HttpWebResponse res = (HttpWebResponse)req.GetResponse()) { using (StreamReader sr = new...

Why am I getting a "double response" from HttpWebResponse?

The follow code (running in ASP.Net 2.0) displays the contents of the requested URL twice. I only want it to display the contents of the requested URL once. I can't figure out what I'm doing wrong. The URL requested is returning XML and if I visit the URL directly, it works fine. HttpWebRequest request = (HttpWebRequest)WebRequest.Creat...

HttpWebRequest over SSL?

I've used HttpWebRequests to post data to HTTPS websites before, and I've never had todo anything different than a regular HTTP Post. Does anyone know if there are any tricks involved that I missed to ensure that this is done properly? ...

HttpWebRequest, known problems with canceling requests?

Are there any known issues with canceling HttpWebRequest HTTP requests? We find that when we cancel 4-5 requests, the next request hangs indefinitely. If there are no known problems with this, then I'm probably doing something wrong... where is a good resource example that shows how this works (a complete solution, not a couple of code ...

Use HttpWebRequest to download web pages without key sensitive issues

Use HttpWebRequest to download web pages without key sensitive issues ...

Simulating connection problems for .NET HttpWebRequest

Are there ways to programmatically simulate connection problems (slow connection, response does not complete, connection gets dropped, etc.) when using the HttpWebRequest class? Thanks EDIT: To elaborate more, I need this for debugging but would want to turn it into a test eventually. I'm using the async methods BeginGetRequestStream, ...

C#: Downloading a URL with timeout

What's the best way to do it in .NET? I always forget what I need to Dispose() (or wrap with using). EDIT: after a long time using WebRequest, I found out about customizing WebClient. Much better. ...

c# HttpWebRequest Server Unavailable 503 problem

I originally used WebRequest and WebResponse to sent Http Post Messages. Always I got a response of "OK". The message I post is an XML signed with a certificate in the xml. The composition is this: CSharp service that is sending to a https website. HTTPS Website on another place that I cant say. HTTPS Local Website locally that is just...

Use HTTPWebRequest to get remote page's title

I have a web service that acts as an interface between a farm of websites and some analytics software. Part of the analytics tracking requires harvesting the page title. Rather than passing it from the webpage to the web service, I would like to use HTTPWebRequest to call the page. I have code that will get the entire page and parse ou...

How to print out the HttpWebRequest in C#?

I'm having a problem with a POST I'm doing using the HttpWebRequest object from C#. In order to analyze the problem I would like to know exactly what is being sent over the wire. The problem is that I'm also using HTTPS so I can't sniff the wire. I need some way of printing out to the Console all the relevant information of the HttpWebRe...

Converting Raw HTTP Request into HTTPWebRequest Object

In .NET is it possible to convert a raw HTTP request to HTTPWebRequest object? I'm sure .NET internally doing it. Any idea which part of the .NET is actually handling this? Can I call it or is there any external library which allows raw HTTP connections? ...

C# .NET Uploading file to a web form using HttpWebRequest

Does anyone have a working example using HttpWebRequest in C# to submit a file from the local drive to a multipart/form-data web form? ...

If CHttpConnection::OpenRequest returns NULL how do I find out why

c++ mfc if CHttpConnection::OpenRequest returns a null what can I use to get the internet error. The mfc artical doesn't say what a bad responce looks like. I just said it returns a handle to a CHttpFile. ...

HttpWebRequest Won't Serialize

I'm getting the following error when I try to Serialize an HttpWebRequest Type 'System.Net.KnownHttpVerb' in Assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. Using .Net Framework 2.0 This is one of the properties that my class holds. It's a requirement to s...

How do I seamlessly compress the data I post to a form using C# and IIS?

I have to interface with a slightly archaic system that doesn't use webservices. In order to send data to this system, I need to post an XML document into a form on the other system's website. This XML document can get very large so I would like to compress it. The other system sits on IIS and I use C# my end. I could of course implemen...

Uri.EscapeDataString(Request.Url.AbsoluteUri) is wrong in different environment, What else should I use?

I am generating a return url link so when the user hits the close button on this page they return to this ReturnUrl. ie http://localhost:42605/Search.aspx?ReturnUrl=http%3A%2F%2Flocalhost%3A42605%2FStuff%2FViewStuff.aspx%3FProjectId%3D2246 This works fine in dev environment, but in uat environment I have http://app-uat.com/Search.aspx...

Django Authentication from .NET using HttpWebRequest and HttpWebResponse via HTTP POST

I am creating an application in .NET that will serve as a second UI for my already-deployed Django app. For some operations users need to authenticate themselves (as Django users). I used a super-simple way to do this (without encrypting credentials for simplicity):- Step 1. I created a django view that accepted the username and passwor...