HttpWebRequest.GetResponse() throwing 500 errorhttp://forums.asp.net/t/1373175.aspx/1?HttpWebRequest+GetResponse+throwing+500+errorSun, 25 Jul 2010 19:50:45 -040013731752878107http://forums.asp.net/p/1373175/2878107.aspx/1?HttpWebRequest+GetResponse+throwing+500+errorHttpWebRequest.GetResponse() throwing 500 error <p>I know I'm getting a valid response back from this thrid party API that I made the request to because I can plug in the URL that my request sent to the 3rd party REST API server manually and I get a valud response back in XML in the browser.&nbsp; However for some reason besides the fact that I see a valid response while testing the request URL manually that my code produced (while debugging through it), I still get a 500 error on GetResponse():</p> <p>&nbsp;</p> <pre class="prettyprint">public static HttpWebResponse SendRequest(HttpWebRequest request) { HttpWebResponse response; request.Timeout = 30000; request.Method = &quot;POST&quot;; request.ContentType = &quot;application/x-www-form-urlencoded&quot;; byte[] requestBytes = Encoding.UTF8.GetBytes(request.ToString()); request.ContentLength = requestBytes.Length; using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(requestBytes, 0, requestBytes.Length); requestStream.Close(); } <b>response = (HttpWebResponse)request.GetResponse(); // I get error: The remote server returned an error: (500) Internal Server Error.</b> if (response == null) throw new NullReferenceException(&quot;Response received was null&quot;); return response; }</pre>If the remote server is no longer complaining about my request and I'm getting what seems to be a valid value back from their API, then why all the fuss by the GetResponse method still?&nbsp; I'm testing this over localhost but that should not matter.<br> 2009-01-20T03:03:01-05:002880731http://forums.asp.net/p/1373175/2880731.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>Below are a few examples you might want to try... did a little cutting/pasting and didn't try to compile, but should work fine.&nbsp;&nbsp;&nbsp;Wrote these methods&nbsp;a few years ago and have been working fine since.&nbsp;&nbsp;<pre class="prettyprint">public class HttpPost { static public string GetResponseAsString( string url, int timeout ) { HttpWebRequest webRequest = (HttpWebRequest)System.Net.WebRequest.Create( url ); webRequest.AllowAutoRedirect = true; webRequest.Timeout = 1000 * 30; webRequest.UserAgent = &quot;Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)&quot;; webRequest.PreAuthenticate = true; webRequest.Credentials = CredentialCache.DefaultCredentials;</pre><pre class="prettyprint"> webRequest.Proxy = <SPAN class=kwd>new</SPAN> System.Net.WebProxy("your proxy server", <SPAN class=kwd>true</SPAN>); // comment out if you're not going thru a proxy WebResponse webResponse = <SPAN class=kwd>null</SPAN>; <SPAN class=kwd>try</SPAN> { webResponse = webRequest.GetResponse(); Stream stream = webResponse.GetResponseStream(); Encoding encoding = System.Text.Encoding.GetEncoding( <SPAN class=st>"utf-8"</SPAN> ); StreamReader streamReader = <SPAN class=kwd>new</SPAN> StreamReader( stream, encoding ); <SPAN class=kwd>string</SPAN> result = streamReader.ReadToEnd(); <SPAN class=kwd>return</SPAN> result; } <SPAN class=kwd>catch</SPAN> ( Exception e ) { <SPAN class=kwd>return</SPAN> e.Message; } } <SPAN class=kwd>static public</SPAN> HttpWebResponse GetResponse(<SPAN class=kwd>string</SPAN> url) { HttpWebRequest webRequest = (HttpWebRequest)System.Net.WebRequest.Create(url); webRequest.Proxy = <SPAN class=kwd>new</SPAN> System.Net.WebProxy("your proxy server", <SPAN class=kwd>true</SPAN>); // comment out if you're not going thru a proxy webRequest.AllowAutoRedirect = <SPAN class=kwd>true</SPAN>; webRequest.Timeout = 1000 * 30; webRequest.UserAgent = <SPAN class=st>"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"</SPAN>; webRequest.PreAuthenticate = <SPAN class=kwd>true</SPAN>; webRequest.Credentials = CredentialCache.DefaultCredentials; <SPAN class=kwd>return</SPAN> (HttpWebResponse)webRequest.GetResponse(); } }</pre>&nbsp;</PRE></p> 2009-01-21T05:44:28-05:002885031http://forums.asp.net/p/1373175/2885031.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>&nbsp;Thanks for the example.</p> <p>&nbsp;Here's the thing, we've use the code I posted before in another non-related app of ours.&nbsp; We can do it testing over localhost as well.&nbsp; So why the heck can't I receive the response without getting a 500 error in this one over localhost after sending the web request to the 3rd party API when the browser is showing me (when you past in the request in the url for testing in the browser) that I'm getting back a valid API response/SOAP message from the 3rd party REST API?&nbsp;&nbsp; I don't know that I really need any authentication properties here like PreAuthenticate, credentials, etc.&nbsp; I've tried them and they do not make any difference to getting through to successfully grabbing back the response here without getting the 500 error.&nbsp; I've also seen another framework use the same request properties and same syntax to receive the response successfully.&nbsp; But not sure if they were testing over localhost.<br> </p> 2009-01-22T16:25:36-05:002885070http://forums.asp.net/p/1373175/2885070.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>&nbsp;Keep in mind I'm running this via localhost on a Vista PC so IIS 7.&nbsp; I've tried both using just plain localhost as well as the VS web server for localhost:port.&nbsp; </p> <p>&nbsp;</p> <p>here's the request /&nbsp; reponse being sent over the wire:</p> <p>&nbsp;POST /xxxxxx.aspx HTTP/1.1<br> Host: localhost<br> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 (.NET CLR 3.5.30729)<br> Accept: text/html,application/xhtml&#43;xml,application/xml;q=0.9,*/*;q=0.8<br> Accept-Language: en-us,en;q=0.5<br> Accept-Encoding: gzip,deflate<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br> Keep-Alive: 300<br> Connection: keep-alive<br> Referer: http://localhost/xxxxx.aspx<br> Content-Type: application/x-www-form-urlencoded<br> Content-Length: 249<br> __VIEWSTATE=%2FwEPDwUKLTEwNjg4NTM5OGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFDmJ0bkxvZ2luQnV0dG9uejCq%2FmxnC032x2Pvh7Yu8vXJwm4%3D&amp;__EVENTVALIDATION=%2FwEWAgKj8tnxBAKR2da8DAJkTWCYFwyhYjDbsPvNqaUBw%2BY5&amp;btnLoginButton.x=41&amp;btnLoginButton.y=14</p> <p>&nbsp;</p> <p>HTTP/1.x 500 Internal Server Error<br> Cache-Control: private<br> Content-Type: text/html; charset=utf-8<br> Server: Microsoft-IIS/7.0<br> X-AspNet-Version: 2.0.50727<br> X-Powered-By: ASP.NET<br> Date: Thu, 22 Jan 2009 17:38:41 GMT<br> Content-Length: 5901<br> <br> </p> <p>&nbsp;</p> 2009-01-22T16:42:46-05:002885081http://forums.asp.net/p/1373175/2885081.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>&nbsp;Not sure if you have figured out the solution for this particular case. One thing i can suggest can you please check whether this 3rd party API accept request only in Get method.In that case use </p> <p>&nbsp;</p> <pre class="prettyprint">request.Method = &quot;GET&quot;;</pre> <p>&nbsp;instead of<br></p><pre class="prettyprint">request.Method = <span class="st">"POST"</span>;</pre><pre class="prettyprint">&nbsp;</pre><pre class="prettyprint">Thanks&nbsp;</pre> 2009-01-22T16:47:53-05:002885109http://forums.asp.net/p/1373175/2885109.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>They are definitely expecting a POST.</p> <p>Also, here is the error trace from IIS 7</p> <p>&nbsp;</p> <p>IIS Diagnostics Output <br> Url: http://localhost:80/xxxx.aspx <br> Site: 3 <br> App Pool: DefaultAppPool <br> Process: 992 <br> Authentication: anonymous <br> User from token: xxxx\xxxx&#36; <br> Activity ID: {00000000-0000-0000-1600-0080020000FC} <br> Failure Reason: STATUS_CODE <br> Final Status:&nbsp; 500 <br> Time Taken: 514 msec <br> IIS Trace Detail Highlights <br> No.&nbsp; EventName Details Time <br> 81. n n r&nbsp; MODULE_SET_RESPONSE_ERROR_STATUS<br> Warning ModuleName=&quot;ManagedPipelineHandler&quot;, Notification=&quot;EXECUTE_REQUEST_HANDLER&quot;, HttpStatus=&quot;500&quot;, HttpReason=&quot;Internal Server Error&quot;, HttpSubStatus=&quot;0&quot;, ErrorCode=&quot;The operation completed successfully. (0x0)&quot;, ConfigExceptionInfo=&quot;&quot; 17:44:45.056 <br> IIS Trace Detail <br> No.&nbsp; EventName Details Time <br> 1. n n i&nbsp; GENERAL_REQUEST_START SiteId=&quot;3&quot;, AppPoolId=&quot;DefaultAppPool&quot;, ConnId=&quot;59594576&quot;, RawConnId=&quot;59594584&quot;, RequestURL=&quot;http://localhost:80/xxxx.aspx&quot;, RequestVerb=&quot;POST&quot; 17:44:44.542 <br> 2. n n i&nbsp; FILTER_START FilterName=&quot;C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_filter.dll&quot; 17:44:44.542 <br> 3. n n i&nbsp; FILTER_PREPROC_HEADERS_START&nbsp; 17:44:44.542 <br> 4. n n i&nbsp; FILTER_SET_REQ_HEADER HeaderName=&quot;AspFilterSessionId:&quot;, HeaderValue=&quot;&quot; 17:44:44.542 <br> 5. n n i&nbsp; FILTER_PREPROC_HEADERS_END&nbsp; 17:44:44.542 <br> 6. n n i&nbsp; FILTER_END&nbsp; 17:44:44.542 <br> 7. n n i&nbsp; URL_CACHE_ACCESS_START RequestURL=&quot;/xxxx.aspx&quot; 17:44:44.542 <br> 8. n n i&nbsp; URL_CACHE_ACCESS_END PhysicalPath=&quot;&quot;, URLInfoFromCache=&quot;true&quot;, URLInfoAddedToCache=&quot;false&quot;, ErrorCode=&quot;The operation completed successfully. (0x0)&quot; 17:44:44.542 <br> 9. n n i&nbsp; GENERAL_GET_URL_METADATA PhysicalPath=&quot;C:\www\xxx\xxxb\xxx\xxx.aspx&quot;, AccessPerms=&quot;513&quot; 17:44:44.542 <br> 10. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;RequestFilteringModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 11. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;RequestFilteringModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 12. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;RequestMonitorModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 13. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;RequestMonitorModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 14. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;ConfigurationValidationModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 15. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;ConfigurationValidationModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 16. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;IpRestrictionModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 17. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;IpRestrictionModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 18. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;FailedRequestsTracingModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 19. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;FailedRequestsTracingModule&quot;, Notification=&quot;BEGIN_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 20. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 21. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 22. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;BasicAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 23. n n i&nbsp; AUTH_START AuthTypeSupported=&quot;Basic&quot; 17:44:44.542 <br> 24. n n i&nbsp; AUTH_END&nbsp; 17:44:44.542 <br> 25. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;BasicAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 26. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;WindowsAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 27. n n i&nbsp; AUTH_START AuthTypeSupported=&quot;NT&quot; 17:44:44.542 <br> 28. n n i&nbsp; AUTH_END&nbsp; 17:44:44.542 <br> 29. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;WindowsAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 30. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;WindowsAuthentication&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 31. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;MAP_PATH&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 32. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;MAP_PATH&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 33. n n &#151;&nbsp; NOTIFY_MODULE_COMPLETION ModuleName=&quot;WindowsAuthentication&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 34. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;CertificateMappingAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 35. n n i&nbsp; AUTH_START AuthTypeSupported=&quot;MapCliCert&quot; 17:44:44.542 <br> 36. n n i&nbsp; AUTH_END&nbsp; 17:44:44.542 <br> 37. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;CertificateMappingAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 38. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;DigestAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 39. n n i&nbsp; AUTH_START AuthTypeSupported=&quot;Digest&quot; 17:44:44.542 <br> 40. n n i&nbsp; AUTH_END&nbsp; 17:44:44.542 <br> 41. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;DigestAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 42. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;IISCertificateMappingAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 43. n n i&nbsp; AUTH_START AuthTypeSupported=&quot;MapCliCert&quot; 17:44:44.542 <br> 44. n n i&nbsp; AUTH_END&nbsp; 17:44:44.542 <br> 45. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;IISCertificateMappingAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 46. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;ScriptModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 47. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;ScriptModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 48. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;AnonymousAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 49. n n i&nbsp; AUTH_START AuthTypeSupported=&quot;Anonymous&quot; 17:44:44.542 <br> 50. n n i&nbsp; AUTH_REQUEST_AUTH_TYPE RequestAuthType=&quot;Anonymous&quot; 17:44:44.542 <br> 51. n n i&nbsp; AUTH_SUCCEEDED AuthType=&quot;3&quot;, NTLMUsed=&quot;false&quot;, RemoteUserName=&quot;&quot;, AuthUserName=&quot;&quot;, TokenImpersonationLevel=&quot;ImpersonationDelegate&quot; 17:44:44.542 <br> 52. n n i&nbsp; AUTH_END&nbsp; 17:44:44.542 <br> 53. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;AnonymousAuthenticationModule&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 54. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;DefaultAuthentication&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotification=&quot;true&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 55. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;DefaultAuthentication&quot;, Notification=&quot;AUTHENTICATE_REQUEST&quot;, fIsPostNotificationEvent=&quot;true&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 56. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;AUTHORIZE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 57. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;AUTHORIZE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 58. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;UrlAuthorization&quot;, Notification=&quot;AUTHORIZE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 59. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;UrlAuthorization&quot;, Notification=&quot;AUTHORIZE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 60. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;FileAuthorization&quot;, Notification=&quot;AUTHORIZE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 61. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;FileAuthorization&quot;, Notification=&quot;AUTHORIZE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 62. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;UrlAuthorizationModule&quot;, Notification=&quot;AUTHORIZE_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 63. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;UrlAuthorizationModule&quot;, Notification=&quot;AUTHORIZE_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 64. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;HttpCacheModule&quot;, Notification=&quot;RESOLVE_REQUEST_CACHE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 65. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;HttpCacheModule&quot;, Notification=&quot;RESOLVE_REQUEST_CACHE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 66. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;OutputCache&quot;, Notification=&quot;RESOLVE_REQUEST_CACHE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 67. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;OutputCache&quot;, Notification=&quot;RESOLVE_REQUEST_CACHE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 68. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;StaticCompressionModule&quot;, Notification=&quot;MAP_REQUEST_HANDLER&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 69. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;StaticCompressionModule&quot;, Notification=&quot;MAP_REQUEST_HANDLER&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 70. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;HttpRedirectionModule&quot;, Notification=&quot;MAP_REQUEST_HANDLER&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 71. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;HttpRedirectionModule&quot;, Notification=&quot;MAP_REQUEST_HANDLER&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 72. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;ManagedPipelineHandler&quot;, Notification=&quot;MAP_REQUEST_HANDLER&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 73. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;ManagedPipelineHandler&quot;, Notification=&quot;MAP_REQUEST_HANDLER&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 74. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;Session&quot;, Notification=&quot;REQUEST_ACQUIRE_STATE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 75. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;Session&quot;, Notification=&quot;REQUEST_ACQUIRE_STATE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 76. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;Profile&quot;, Notification=&quot;REQUEST_ACQUIRE_STATE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 77. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;Profile&quot;, Notification=&quot;REQUEST_ACQUIRE_STATE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 78. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;ScriptModule&quot;, Notification=&quot;REQUEST_ACQUIRE_STATE&quot;, fIsPostNotification=&quot;true&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 79. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;ScriptModule&quot;, Notification=&quot;REQUEST_ACQUIRE_STATE&quot;, fIsPostNotificationEvent=&quot;true&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:44.542 <br> 80. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;ManagedPipelineHandler&quot;, Notification=&quot;EXECUTE_REQUEST_HANDLER&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:44.542 <br> 81. n n r&nbsp; MODULE_SET_RESPONSE_ERROR_STATUS<br> Warning ModuleName=&quot;ManagedPipelineHandler&quot;, Notification=&quot;EXECUTE_REQUEST_HANDLER&quot;, HttpStatus=&quot;500&quot;, HttpReason=&quot;Internal Server Error&quot;, HttpSubStatus=&quot;0&quot;, ErrorCode=&quot;The operation completed successfully. (0x0)&quot;, ConfigExceptionInfo=&quot;&quot; 17:44:45.056 <br> 82. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;ManagedPipelineHandler&quot;, Notification=&quot;EXECUTE_REQUEST_HANDLER&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_FINISH_REQUEST&quot; 17:44:45.056 <br> 83. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;AspNetFilterModule&quot;, Notification=&quot;LOG_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 84. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;AspNetFilterModule&quot;, Notification=&quot;LOG_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 85. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;CustomLoggingModule&quot;, Notification=&quot;LOG_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 86. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;CustomLoggingModule&quot;, Notification=&quot;LOG_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 87. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;RequestMonitorModule&quot;, Notification=&quot;END_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 88. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;RequestMonitorModule&quot;, Notification=&quot;END_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 89. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;Session&quot;, Notification=&quot;END_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 90. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;Session&quot;, Notification=&quot;END_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 91. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;Profile&quot;, Notification=&quot;END_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 92. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;Profile&quot;, Notification=&quot;END_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 93. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;ScriptModule&quot;, Notification=&quot;END_REQUEST&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 94. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;ScriptModule&quot;, Notification=&quot;END_REQUEST&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 95. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;ScriptModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 96. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;ScriptModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 97. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;DigestAuthenticationModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 98. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;DigestAuthenticationModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 99. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;DynamicCompressionModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 100. n n i&nbsp; DYNAMIC_COMPRESSION_START&nbsp; 17:44:45.056 <br> 101. n n i&nbsp; DYNAMIC_COMPRESSION_NOT_SUCCESS Reason=&quot;NOT_SUCCESS_STATUS&quot; 17:44:45.056 <br> 102. n n i&nbsp; DYNAMIC_COMPRESSION_END&nbsp; 17:44:45.056 <br> 103. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;DynamicCompressionModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 104. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;WindowsAuthenticationModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 105. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;WindowsAuthenticationModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 106. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;HttpLoggingModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 107. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;HttpLoggingModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 108. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;IsapiModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 109. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;IsapiModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 110. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;BasicAuthenticationModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 111. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;BasicAuthenticationModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 112. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 113. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;IsapiFilterModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 114. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;ProtocolSupportModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 115. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;ProtocolSupportModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 116. n n &#151;&nbsp; NOTIFY_MODULE_START ModuleName=&quot;CustomErrorModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotification=&quot;false&quot;, fIsCompletion=&quot;false&quot; 17:44:45.056 <br> 117. n n &#151;&nbsp; NOTIFY_MODULE_END ModuleName=&quot;CustomErrorModule&quot;, Notification=&quot;SEND_RESPONSE&quot;, fIsPostNotificationEvent=&quot;false&quot;, NotificationStatus=&quot;NOTIFICATION_CONTINUE&quot; 17:44:45.056 <br> 118. n n i&nbsp; HTTPSYS_CACHEABLE HttpsysCacheable=&quot;false&quot;, Reason=&quot;VERB_NOT_GET&quot; 17:44:45.056 <br> 119. n n i&nbsp; GENERAL_FLUSH_RESPONSE_START&nbsp; 17:44:45.056 <br> 120. n n i&nbsp; GENERAL_FLUSH_RESPONSE_END BytesSent=&quot;6141&quot;, ErrorCode=&quot;The operation completed successfully. (0x0)&quot; 17:44:45.056 <br> 121. n n i&nbsp; GENERAL_REQUEST_END BytesSent=&quot;6141&quot;, BytesReceived=&quot;769&quot;, HttpStatus=&quot;500&quot;, HttpSubStatus=&quot;0&quot; 17:44:45.056 <br> &nbsp;</p> 2009-01-22T17:06:30-05:002885297http://forums.asp.net/p/1373175/2885297.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>&nbsp;Ok, finally got a stack trace to work with. </p> <p>&nbsp;Server Error in '/' Application.<br> The remote server returned an error: (500) Internal Server Error.<br> 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.<br> <br> Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.<br> <br> Source Error:<br> <br> Line 50:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; requestStream.Close();<br> Line 51:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> Line 52: <br> Line 53:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response = (HttpWebResponse)request.GetResponse();<br> <br> <br> Source File: C:\www\xxxxxx\Core\Requestxxx.cs&nbsp;&nbsp;&nbsp; Line: 52<br> <br> Stack Trace:<br> <br> [WebException: The remote server returned an error: (500) Internal Server Error.]<br> &nbsp;&nbsp; System.Net.HttpWebRequest.GetResponse() &#43;5313085<br> &nbsp;&nbsp; Facebook.Core.Requestxxx.xxxRequest(HttpWebRequest request) in C:\www\xxx\xxx\Core\Requestxxx.cs:52<br> &nbsp;&nbsp; Facebook.Core.xxxRequest.SendRequest() in C:\www\xxx\xxx\Core\xxxRequest.cs:227<br> &nbsp;&nbsp; Facebook.Core.xxxRequest.CreateAuthToken() in C:\www\xxx\xxx\Core\xxxRequest.cs:33<br> &nbsp;&nbsp; Facebook.Core.xxxRequest.GetLoginURL() in C:\www\xxx\xxx\Core\AuthRequest.cs:46<br> &nbsp;&nbsp; FacebookWeb.FacebookLogin.btnLoginButton_Click(Object sender, EventArgs e) in C:\www\xxx\xxxb\xxx\xxx.aspx.cs:23<br> &nbsp;&nbsp; System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) &#43;108<br> &nbsp;&nbsp; System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) &#43;118<br> &nbsp;&nbsp; System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) &#43;10<br> &nbsp;&nbsp; System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) &#43;13<br> &nbsp;&nbsp; System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) &#43;36<br> &nbsp;&nbsp; System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) &#43;1565<br> <br> <br> Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 <br> </p> <p>&nbsp;</p> 2009-01-22T18:27:10-05:002885497http://forums.asp.net/p/1373175/2885497.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>&nbsp;Entire problem was I needed to use GET.&nbsp; When sending a request out (Whether it's a SOAP message or just a url request to a 3rd party API), you use GET because you want to get the response back.&nbsp; Otherwise POST is used the other way around, if you were the SOA framework and exposed your API, you'd want to take what's coming in (request) and process it....then you'd use POST.</p> <p>&nbsp;Also, I did not I guess need the following lines:</p> <p>&nbsp; <br> </p> <pre class="prettyprint">request.ContentType = &quot;application/x-www-form-urlencoded&quot;; byte[] requestBytes = Encoding.UTF8.GetBytes(request.ToString()); request.ContentLength = requestBytes.Length; using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(requestBytes, 0, requestBytes.Length); requestStream.Close(); }</pre><pre class="prettyprint">&nbsp;</pre><pre class="prettyprint">as I'm not sending a SOAP message, I am not sure what those lines woudl be used for. I got them from some other code that worked in the past for a similar kind of call to the same API provider.<br></pre> 2009-01-22T20:16:51-05:002885522http://forums.asp.net/p/1373175/2885522.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>Congrads on getting it resolved!&nbsp;&nbsp; As for your GET/POST definitions, it's not quite correct.&nbsp; The difference is that in GET, the name/value pairs are in the URL, where as POST embeds them in the http request.&nbsp; There are reasons to use both in both situations.&nbsp; Anyway, glad you got it fixed.</p> 2009-01-22T20:33:33-05:003991134http://forums.asp.net/p/1373175/3991134.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>I have the same problem.&nbsp;</p> <p>when I use HttpWebRequest.GetResponse() it throws error 500.</p> <p>I can also say for sure that the request never reaches&nbsp;an invoked webmethod of the webservice since I perform it localy and debugger never stops in that method.</p> <p>however adding a webreference and invoking its methods like Serive.Method() works fine.</p> <p>I'm also 100% sure that XML I post is correct.</p> <p>Please don't ask why do I use GetResponse if I can just add a reference.. I just have my reasons for that.</p> <p>the question is why does it works with one webservice and throws 500th error with the other located on the very same machine.</p> <p>I'm really frustrated.</p> <p>Please help as soon as possible.</p> <p>Thank you in advance.</p> <p>Any help will be greatly appreciated.</p> 2010-07-25T15:15:21-04:003991365http://forums.asp.net/p/1373175/3991365.aspx/1?Re+HttpWebRequest+GetResponse+throwing+500+errorRe: HttpWebRequest.GetResponse() throwing 500 error <p>Solved my issue.</p> <p>In my case the actual error was</p> <p><strong>System.Web.Services.Protocols.SoapException: Unable to handle request without a valid action parameter. Please supply a valid soap action.</strong></p> <p>(I've found it out by tracing HTTP requests in IIS 7.)</p> <p>which eventualy took me to the namespace name I was using for my webservice. it was just one word.&nbsp;some name. when I changed it to a link it started to work like a charm.</p> <p>&nbsp;</p> <p>Hope my experience helps to someone else.</p> <p>Good luck.</p> 2010-07-25T19:50:45-04:00