Monday, April 28, 2008

My Morning Jacket and The Black Keys at Red Rocks Amphitheatre

August 21st 2008, The Black Keys will be opening for My Morning Jacket at Red Rocks Amphitheatre and I have tickets!! It's the only show that the two bands will be playing together on their separate tours. I've never been to Denver, so this will be an all around great trip. Red Rocks, a Hard Rock Cafe I don't have a shot glass from, downtown Denver, and some of the best music around. NICE!!

Post Http request in code behind example

public XmlDocument Send(string url, XmlDocument reqdoc)
{
//Start by creating the request using given URL
  HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(url);
  httpReq.Method = @"POST";
  httpReq.ContentType = @"text/xml"; //Using XML
  httpReq.Timeout = 600000;//10 minutes (in milliseconds)
  httpReq.KeepAlive = false;

  Stream strm = httpReq.GetRequestStream();
  reqdoc.Save(strm);
  strm.Close();
//Create HttpWebRewponse to handle the result
  HttpWebResponse resp = (HttpWebResponse)httpReq.GetResponse();

  StreamReader srdr = new StreamReader(resp.GetResponseStream(),Encoding.GetEncoding("UTF-8"));
  string xmlstr = srdr.ReadToEnd();

  resp.Close();

  respdoc = new XmlDocument();

  try
  {
    StringBuilder sb = new StringBuilder(xmlstr);
//Remove undefined chars
    for(int c=0; c<sb.Length; c++)
    {
      if (sb[c]<'\x20')
      {
        sb[c]='\x20';
      }
    }

    respdoc.LoadXml(sb.ToString());

    respXmlStr = respdoc.OuterXml;
  }
  catch(Exception e)
  {
    string msg = "Invalid XML response returned: " + e.Message;
    LogExceptionData(msg,xmlstr);
    throw new Exception(msg,e);
    }
      return respdoc;
    }
}