Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.68 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. WCF call via MSMQ erratic
  2. protected void Page_Load(object sender, EventArgs e)
  3. {
  4.   if ((Request.HttpMethod == "POST") && (Request.ContentType == "text/xml"))
  5.   {
  6.     string filename = string.Format("{0:yyyyMMddHHmmss}.xml", DateTime.UtcNow);
  7.     var path = Path.Combine(Request.MapPath("Chapters"), Request.Headers["X-MAC"]);
  8.     Directory.CreateDirectory(path);
  9.     string xml;
  10.     using (ChapterWriterClient client = new ChapterWriterClient())
  11.     using (StreamReader sr = new StreamReader(Request.InputStream))
  12.     {
  13.       xml = sr.ReadToEnd();
  14.       client.Write(xml);
  15.       System.Diagnostics.Trace.TraceInformation(xml);
  16.     }
  17.     Request.SaveAs(Path.Combine(path, filename), false);
  18.   }