Need suggestion on how to find more detail from a Web response for a generic handler Post ? RRS feed

  • Question

  • User-49466106 posted


    I made an update to a web handler which is currently used in production.

    The updated version has been deployed on a test server (2008) and I am having problems

    getting the handler to respond.

    In my test app when I connect a get a "null" response.

    The problem is not getting enough feedback from asp.net on why null is returned by the web response.

    I am using a trace to get the response and this gives a very generic message.

    My test app sends the contents of an xml file to the handler which "echos" the contents to a textbox on a web page.

    So there are no errors just a null response.

    This same test code works when I connect to the production web handler on my local machine

    Is there a way to see any more details on the response ?

    Thanks for any insights !

    Here is my code -

    WebRequest req = null;
    WebResponse rsp = null;
                 String uri = "some ip";
                  req = WebRequest.Create(uri);
                  req.Method = "POST";        // Post method
                  req.ContentType = "text/xml";     // content type 
                  StreamWriter writer = new StreamWriter(req.GetRequestStream());
                  StreamReader reader = new StreamReader(Server.MapPath("~/Test.xml"));
                  string ret = reader.ReadToEnd();
                  rsp = req.GetResponse();
                  StreamReader sr = new StreamReader(rsp.GetResponseStream());
                  string responseString = sr.ReadToEnd();
                  TextBox1.Text = responseString;
                catch (WebException webEx)
                    Trace.Write("From Web: " + webEx.Message);
                catch (Exception ex)
                    Trace.Write("From System: " + ex.Message);
                    if (req != null) req.GetRequestStream().Close();
                    if (rsp != null) rsp.GetResponseStream().Close();

    Friday, June 29, 2012 12:55 PM

All replies

  • User-661350001 posted

    try changing the url and get the response and see if that server is not accepting it

    Friday, June 29, 2012 1:16 PM
  • User-49466106 posted


    I can change my uri to the production site and I get a response.

    Could this be due to a setting in IIS.

    Although I did compare production to test IIS settings and the look the same.

    I have made the necessary firewall changes to allow database and remote responses.

    Friday, June 29, 2012 1:36 PM
  • User-49466106 posted

    Would using a tool like fidler help me diagnoise my problem ?

    I don't get a response when running the app on the test server as localHost could some tool like fiddler work on the server ?


    Saturday, June 30, 2012 10:41 PM