Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micahasmith/2639215 to your computer and use it in GitHub Desktop.
Save micahasmith/2639215 to your computer and use it in GitHub Desktop.
nonasync web request httphandler
public class nonasync_webrequest_test : IHttpHandler {
public void ProcessRequest (HttpContext context) {
var r = new RequestState()
{
Wr = WebRequest.Create("http://www.google.com"),
Cxt = context
};
r.Wr.Method = "GET";
var s= r.Wr.GetResponse();
r.Cxt.Response.ContentType = "text/plain";
r.Cxt.Response.Write(string.Format("Hello World async {0}", RequestState.ReadStream(s.GetResponseStream())));
}
public bool IsReusable {
get {
return true;
}
}
}
@micahasmith
Copy link
Author

retested with IsReusable=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment