0

There is an old article in the MSDN Magazine with a walk-through to implement in C# the equivalent of the Javascript XMLHttpRequest object.

I find it very interesting but the code is not downloadable anymore.

Do you know of an implementation similar to the Javascript XMLHttpRequest object but in C#? Among other thinks, this implementation can:

  • Send http requests to the server.
  • Send requests both synchronously and asynchronously.
  • Allows to abort long running processes.

I know it all can be done easily with the HTTPWebRequest object in .NET, but after reading the article I was hoping that a wrapper would be available as it used to be in the code of that article (the link is dead).

Thanks,

0

3 Answers 3

4

Have a look at the WebClient Class.

Sign up to request clarification or add additional context in comments.

Comments

2

You can use WebClient.DownloadString that is a good wrapper around a web request. You can have a non blocking call too ( the better way ) by using DownloadStringAsync

Comments

1

You can use WebClient, though I often find it wraps a bit too much and I end up going back to HTTPWebRequest.

There's plenty of the code from that article in it's figures at http://msdn.microsoft.com/hr-hr/magazine/bb985675%28en-us%29.aspx Enough really to reconstruct the whole thing.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.