0

I get this message "Object reference not set to an instance of an object" from an asp.net site after posting form by Http Post method (idhttp) but I don't meet this message if I submit by a browser. Why? I compare parameters, there are no differences.

I get the response text:

<html><center>Object reference not set to an instance of an object</center></html>

instead of:

<html><center>Congratulations!</center></html>
Sir Rufo
  • 18,395
  • 2
  • 39
  • 73
  • 1
    This is happening in the ASP.NET application. You'll have to debug it from that side. Start with the stack trace to see where the exception is being raised. – Ken White Jul 19 '13 at 18:30
  • @Ken White: I'm not the owner of that site. By the way, I get message only from http post method in my application, with a browser this message won't appear – Nguyễn Linh Jul 19 '13 at 18:36
  • 1
    We can't see what your POST request is sending to the site, so it's impossible for us to see what's wrong. If the browser can send it with no issues, and your app can't, there's obviously a difference between them. The exception is happening on the server, though, and the information you're getting gives no way to determine what's causing it. – Ken White Jul 19 '13 at 18:49
  • @Nguyen: Show some details of the request so we can try to see the difference between the two situations. – AlexSC Jul 19 '13 at 18:50
  • @Ken White: a browser sends some google analytics coookies : __utma=205382415.1956253953.1374197281.1374197281.1374197281.1 205382415.1374197281.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) but my application doesn't. That's the difference, is it important to cause this problem? – Nguyễn Linh Jul 19 '13 at 19:04
  • No, Google Analytics shouldn't cause this issue. There's something else you're missing here. – Ken White Jul 19 '13 at 19:19
  • @Ken White: I send the exactly parameters (form fields, submit button,__VIEWSTATE and __EVENTVALIDATION key). All of them are encoded by RFC3986 method. Content-Type: application/x-www-form-urlencoded. I don't understand why I'm always getting this message. Any helps? – Nguyễn Linh Jul 19 '13 at 19:24
  • As @Ken says, it's the ASP.NET side problem and I would suspect non-browser user agent from what you described. Try to set your `TIdHTTP`'s request user agent to some known browser one if you didn't already do that. – TLama Jul 19 '13 at 19:41
  • @TLama: I've already set User-agent to that browser (chrome) but I'm still getting this message. By the way, there is some javascript not loaded by my application, does it cause the server not init some variable? – Nguyễn Linh Jul 19 '13 at 19:48
  • 1
    No, there's no help, because **we can't see what you're not sending** that the browser does. You'll need to use a tool to capture exactly what's being sent by each and compare them exactly to see what the differences are, and we can't do that from here. (What's the `UserAgent` you're sending? Sometimes that can be an issue.) – Ken White Jul 19 '13 at 19:53
  • The user-agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36 – Nguyễn Linh Jul 19 '13 at 20:01
  • Feel free to delete this question since without knowing the target server and a code you used on Delphi side it can't help to anyone else but you. – TLama Jul 20 '13 at 07:59
  • @Tlama: No need to show the code, this will help because it's just I forgot some field in the header request. If someone meet the same problem, they will notice the header. – Nguyễn Linh Jul 20 '13 at 08:02

1 Answers1

0

Finally, I find out the problem, it was so hard because I'm not the owner of the site. I focused on the body and forgot there is a missing header which is required by the site. Thank you all gently men :)