{"id":1951,"date":"2022-08-30T15:20:48","date_gmt":"2022-08-30T15:20:48","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/05\/getting-an-error-after-sending-a-request-to-web-server-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:20:48","modified_gmt":"2022-08-30T15:20:48","slug":"getting-an-error-after-sending-a-request-to-web-server-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/getting-an-error-after-sending-a-request-to-web-server-collection-of-common-programming-errors\/","title":{"rendered":"Getting an error after sending a request to web server-Collection of common programming errors"},"content":{"rendered":"<p>Guys I am getting the following error on sending xml based request to a server. Could you help me to understand the stack trace?<\/p>\n<p>The remote server returned an error:<\/p>\n<blockquote>\n<p>(500) Internal Server Error.<\/p>\n<p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.<\/p>\n<p>Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal &gt; &gt; Server Error.<\/p>\n<p>Source Error:<\/p>\n<p>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.<\/p>\n<\/blockquote>\n<p>Stack Trace:<\/p>\n<pre><code>[WebException: The remote server returned an error: (500) Internal Server Error.]\n   System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest&amp; request) +302\n   System.Net.WebClient.UploadData(Uri address, String method, Byte[] data) +158\n   System.Net.WebClient.UploadData(String address, Byte[] data) +34\n   WebApplication1._Default.btnSearch_Click(Object sender, EventArgs e) in C:\\Users\\Mubashir\\Documents\\Visual Studio 2008\\Projects\\WebApplication1\\WebApplication1\\Default.aspx.vb:64\n   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111\n   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110\n   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10\n   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13\n   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36\n   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565\n<\/code><\/pre>\n<p>Version Information:<\/p>\n<ul>\n<li>Microsoft .NET Framework Version: 2.0.50727.3623;<\/li>\n<li>ASP.NET Version: 2.0.50727.5053<\/li>\n<\/ul>\n<p>this is my code<\/p>\n<pre><code>Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click\n        Dim s = \"\"\n        s = s &amp; \"\" &amp; vbCrLf\n\n        s = s &amp; \"\"\n        s = s &amp; \"\" &amp; vbCrLf\n\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n\n\n\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; txtDeparture.Text &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; drpFrom.SelectedValue &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; drpTo.SelectedValue &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n        s = s &amp; \"\" &amp; vbCrLf\n\n        Dim url = \"http:\/\/203.189.91.127:9090\/services\/spm\/spm\"\n\n        Dim doc As New XmlDocument()\n\n        doc.LoadXml(s)\n\n        Dim req As HttpWebRequest = WebRequest.Create(url)\n        req.Headers.Add(\"SOAPAction\", \"\")\n\n        req.ContentType = \"text\/xml;charset=\"\"utf-8\"\"\"\n        req.Accept = \"text\/xml\"\n        req.Method = \"POST\"\n        Dim stm As Stream = req.GetRequestStream()\n        doc.Save(stm)\n        stm.Close()\n        Dim resp As WebResponse = req.GetResponse()\n        stm = resp.GetResponseStream()\n        Dim r As StreamReader = New StreamReader(stm)\n        'process SOAP return doc here. For now, we'll just send the XML out to the browser ...\n        Response.Write(r.ReadToEnd())\n\n\n\n    End Sub\n<\/code><\/pre>\n<p>this is my xml that I am sending :<\/p>\n<pre><code>\n\n\n\n\n\n\n\n\n\n\n\n20\/02\/2013\nBLR\nGOI\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-12-05 16:30:04. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Guys I am getting the following error on sending xml based request to a server. Could you help me to understand the stack trace? The remote server returned an error: (500) Internal Server Error. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1951","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1951"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1951\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}