Note that there are some explanatory texts on larger screens.

plurals
  1. POAsp.net mvc3 C#, trace 500 error response message?
    primarykey
    data
    text
    <p>I need to get the 500 error response message from HttpWebResponse.</p> <pre><code>HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } </code></pre> <p><img src="https://i.stack.imgur.com/VFTHX.png" alt="enter image description here"></p> <p>Thank you!</p> <p>[EDIT]</p> <p>open this url using browser,</p> <p><a href="https://www.sagepayments.net/web_services/vterm_extensions/transaction_processing.asmx/BANKCARD_PRIOR_AUTH_SALE" rel="nofollow noreferrer">https://www.sagepayments.net/web_services/vterm_extensions/transaction_processing.asmx/BANKCARD_PRIOR_AUTH_SALE</a></p> <p>The browser will print response message, 'Missing parameter: M_ID."</p> <p>Now, I want to get that response message using asp.net</p> <pre><code>var post_string = "hello=hi"; HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create("https://www.sagepayments.net/web_services/vterm_extensions/transaction_processing.asmx/BANKCARD_PRIOR_AUTH_SALE"); objRequest.Method = "POST"; objRequest.ContentLength = post_string.Length; objRequest.ContentType = "application/x-www-form-urlencoded"; // post data is sent as a stream StreamWriter myWriter = null; myWriter = new StreamWriter(objRequest.GetRequestStream()); myWriter.Write(post_string); myWriter.Close(); // returned values are returned as a stream, then read into a string try { HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } Response.Write(post_response); } catch(WebException e) { Response.Write("Error : "+e.Message); Response.Write("&lt;br /&gt; Data : " + e.Data); Response.Write("&lt;br /&gt; HelpLink : " + e.HelpLink); Response.Write("&lt;br /&gt; InnerException : " + e.InnerException); Response.Write("&lt;br /&gt; Response : " + e.Response); Response.Write("&lt;br /&gt; Source : " + e.Source); Response.Write("&lt;br /&gt; Status : " + e.Status); Response.Write("&lt;br /&gt; TargetSite : " + e.TargetSite); } Result : Error : The remote server returned an error: (500) Internal Server Error. Data : System.Collections.ListDictionaryInternal HelpLink : InnerException : Response : System.Net.HttpWebResponse Source : System Status : ProtocolError TargetSite : System.Net.WebResponse GetResponse() </code></pre> <p>How to get this message ? </p> <p><strong>Missing parameter: M_ID.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload