PostRequest fails in ASP.NET

Hello,

Today we had a failure in the PostRequest function in the LimeLM_API.LimeLM class in the ASP.NET code downloaded from your web site.

We have modified the code to write out to a log at various points in the process, so I know almost where the failure occurred. In the PostRequest function:

<code snippet>// post data is sent as a streamLogger.WriteLog("LimeLM->PostRequest-> post_string = " + post_string);StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream());myWriter.Write(post_string);myWriter.Close();Logger.WriteLog("LimeLM->PostRequest-> code line A");<code snippet>

the first WriteLog executes, but the second does not and nothing further executes as if an unhandled exception occurred. This is part of the automated PayPal process that has worked repeatedly with several customers over the last two weeks.

The post_string contained (formatted for convenience and modifed to hide personal information)post_string = method=limelm.pkey.generate&version_id=1032&num_keys=1&num_acts=1&email=lbi%40telenet.be&feature_name[]=product_code& feature_name[]=address_street&feature_name[]=address_city& feature_name[]=address_country& feature_name[]=first_name& feature_name[]=last_name& feature_name[]=address_state& feature_name[]=address_zip&feature_value[]=GC01.00& feature_value[]=1111+Vista+del+Seado& feature_value[]=Escondido& feature_value[]=Belgium& feature_value[]=First& feature_value[]=last& feature_value[]=CA& feature_value[]=92025&api_key=1n2ntq55130b043575a55.48891123

PayPal approved the payment but the key was not generated.

Can you see the problem or point me in the right direction to find the error?

Can you check if an execption occurred on your end at 11:01:13 PDT (the time the PostRequest was logged)?

Thanks

Can you check if an execption occurred on your end at 11:01:13 PDT (the time the PostRequest was logged)?

We get automatically notified if an exception happens (or anything out of the ordinary, really). Nothing has happened this week.

the first WriteLog executes, but the second does not and nothing further executes as if an unhandled exception occurred.

What was the exception, specifically? (Please copy & paste the full exception).

Since you did not record an exception on your end, it must have happened in the StreamWriter constructor.

The only modification we made to your code was to add the logging so I do not have an execption recorded. I will bracket the offending code in a try - catch block and hope for more information next time.

Also, will you please confirm that the post_string was constructed correctly?

Thanks

That looks about right. If you give me more information (the full exception details for a start) then I'll be able to help you. My guess (and it's just a guess) is that the connection to PayPal failed, and thus an exception was thrown and/or a null object was returned and passed to another contructor causing an exception to be thrown.

So, make sure you log the full exception details in case this happens again.