Impersonating a web user – level 200

One of these days, it will become necessary to impersonate a user at a
website.  Or, a more common use would be to use a legacy ASP app as a
make-shift web service.  Say an ASP page does an important function?  From
your application(whether windows, console, or web), you can write code to
contact this page and interact with it over HTTP.  Here is a sample:

String uriString = http://localhost/WebApplication1/AcceptFile.aspx;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
string fileName = @”c:upload.txt”;
byte[] responseArray = myWebClient.UploadFile(uriString, “POST”, fileName);


Using the WebClient class in the System.Net namespace, it’s very easy to
create a custom web request and execute it.  Then you can capture the
response and analyze it. . . parse any important data contained in it.

If you have used Application Center Test or the Web Application Stress Tool,
you record a web session, and then that session is repeated many times.
Code is being written to repeat the web requests.