webrequest

Lengthy lines of code vs readability

This is perfectly fine C# code and works fine provided correct URL. But the everything is just done at one line by reducing the readability of the code. Here is the code : return new StreamReader(WebRequest.Create(urlName).GetResponse().GetResponseStream()).ReadToEnd(); I am just wondering what are the opinions of fellow de...

c# WebRequest using WebBrowser cookie

hi I am logging into a site using a WebBrowser, then i want use regex to get some data , but webRequest didnt use web Browse cookie , my webBrowser is in public , is there any way to useing webbrowser cookie in webrequest ? ...

Using HTTP Authentication with a C# WebRequest

I want to make a web request to a page that needs authenticating. How would I go about doing this? I found something that said possibly to use the Credentials property, but I'm not sure how to use it. ...

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive.

I'm trying to create a method in C# to return a string of a web pages html content from the url. I have tried several different ways, but I am getting the error System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. The following works fine locally, but gets the above error when runnin...

How can i get IE credentials to use in my code?

I'm currently developing an IE plugin using SpicIE. This plugin does some web scraping similar to the example posted on MSDN: WebRequest request = WebRequest.Create ("http://www.contoso.com/default.html"); request.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse response = (HttpWebResponse)request.GetResponse (); S...

c# WebRequest to connect to wikipedia API

Hey, This may be a pathetically simple problem but I cannot seem to format the post webrequest/response to get data from the wikipedia api. I have posted my code below if anyone can help me see my problem. string pgTitle = txtPageTitle.Text; Uri address = new Uri("http://en.wikipedia.org/w/api.php"); HttpWebRequest request =...

Can .NET WebRequest/WebResponse translate accent marks, diacritical marks, and entities correctly?

I am "screen scraping" my own pages as a temporary hack, using .NET's WebRequest. This works well, but accented characters and diacritical characters do not translate correctly. I am wondering if there is a way to make them translate correctly using .NET's many many built in properties and methods. Here is the code I am using to gra...

Multiple 404 request on our site. Is it attack or just wrong indexing robot?

Our site is receiving requests which try to access non existing pages. Usually it is only case of misspelled address. Like the right link is /Info/SiteMap.aspx, but the bad request is /Inf/SiteMap.aspx with missing 'o'. There are usually many request, like 20 in row in one minute. All throw 404. Is it problem of some indexing robot? Or ...

HttpWebRequest to URL with dot at the end

Hi, when i do a GET with WebRequest.Create("http://abc/test.") i get 404 because according to fiddler the trailing dot gets stripped away by .NET and the web server needs the dot. how can i prevent that or work around it. any workaround is appreciated! ...

dot net:threads running too slow in express edition visual studio 2008?

i am running 12 threads .function which these threads are calling is not having any lock on some object.but still these threads are taking too much time.(16 minutes).each thread ially parsing a xml document which is running alright if run indiviually.is this problem because of some reason related max no threads provided by express editio...

Is there a URL builder that supports request paramater concatenation as well?

I want to achieve something like the following: UrlBuilder ub = new UrlBuilder("http://www.google.com/search"); ub.Parameters.Add("q","request"); ub.Parameters.Add("sourceid","ie8"); string uri = ub.ToString(); //http://www.google.com/search?q=request&sourceid=ie8 Is there anything in .NET, or I will have to create my own? ...

Stream a WAV File From The Web In Silverlight 3

I've managed to discover Gilles Khouzam's playback implementation for WAV files in Silverlight 3 and while that would be the majority of the battle, I'm stuck on a final detail: how do I pull a wav file from the web some place and then feed it into his WaveMediaStreamSource for playback? Here's the closest I've come: public MainCon...

Using the VS Web Test Classes outside Visual Studio

I use HttpWebRequests pretty extensively - I've found that the Visual Studio Web Test classes (i.e. WebTestRequest and WebTestResponse etc) offer a lot of really nice methods that i'd love to start using. But I can't seem to find a way to use these classes outside of the Visual Studio's testing framework. Has anyone done this? ...

Reading data from an open HTTP stream

Hi, I am trying to use the .NET WebRequest/WebResponse classes to access the Twitter streaming API here "http://stream.twitter.com/spritzer.json". I need to be able to open the connection and read data incrementally from the open connection. Currently, when I call WebRequest.GetResponse method, it blocks until the entire response is d...

GUI not responding while fetching data

My application often fetch data from a webpage using WebRequest, but it isn't possible to click buttons etc while it's fetching. I've understood that I have to use threads/a backgroundworker, but I can't get it to work properly; it doesn't make the GUI more respondable. The code I want to apply some kind of threading on, so that it sto...

POST Data to PHP Page Using C# in Place of Form URL

Hello! I have an C# cart application that needs to POST some data to a PHP page and redirect the user to that page to view the data. Everything is working fine! So, what is the problem?? Since we are using a Javascript function to POST the form to the PHP page through setting its action to the PHP URL, it is not allowing us to clear ...

How can I fetch full name and picture from any user's Facebook page?

I'd like to get access to the public information about any user on Facebook. Basically, that means only user pictures and full names, that's all. It's the information you get when you open a page without being logged in, like this: http://www.facebook.com/jurgenappelo However, when I try to do this from code, Facebook returns this mess...

Sending gzipped data in WebRequest?

I have a large amount of data (~100k) that my C# app is sending to my Apache server with mod_gzip installed. I'm attempting to gzip the data first using System.IO.Compression.GZipStream. PHP receives the raw gzipped data, so Apache is not uncompressing it as I would expect. Am I missing something? System.Net.WebRequest req = WebRequest....

C#-WebRequest in a Windows Service

Hi there, I'm currently developing a Windows Service to download some emails in the background. For easy testing, the core of this service can be run in a standalone application, too. There's no problem while downloading the mails (service and standalone) but I'm not able to get a WebRequest when running the service (everything's find i...

View WebRequest XML

Hello, I'm having a strange issue - I saw a similar post on this forum, but it didn't have an answer. Long story short, I am sending an HttpWebRequest using C# to a web service (stubs were created by adding a web reference in Visual Studio 2008, .NET 2.0) which breaks with the following message: "Unable to parse the incoming request". ...