3

We got strange error last days. ___doPostBack is undefined.

We are building quite advanced website, but not using postbacks much. One of place where postback used is ASP.NET Login Status control.

It is probabalystic, sometimes it is rendered, sometimes - not. For IE, Chrome it works mostly fine, but from FireFox it is quite high chance not to have doPostBack in page source.

Any ideas?

PS: In addition, error happens only on live environment, which uses Windows 2003 & IIS 5.0, dotnet framework is 3.5

Can it be because I am using OutputCache on page level?

scohe001
  • 15,110
  • 2
  • 31
  • 51
st78
  • 8,028
  • 11
  • 49
  • 68

4 Answers4

5

Just happened to us: When googlebot or any other bot hits your page before a regular user, the page is cached without any postback options.

We did a simple hack, using different a outputcacheprofile if the request.browser.javascript is false (asp.net sends different versions of the page to those browsers/crawlers/bots)

djspark
  • 180
  • 4
  • 9
  • 1
    If I could vote this up 10 times, I would! Just happened to us also, and so far it looks like this was the culprit. Thanks for the detailed explanation -- I'm not sure when (or if) it would have occurred to me... – Mike Powell Aug 11 '09 at 13:39
2

I had the same problem, but I realized that ASP.NET does not render __doPostback when server controls don't need it.

When I put a gridview or linkbutton that need __doPostback, ASP.NET rendered it.

Diego Mendes
  • 10,631
  • 2
  • 32
  • 36
  • You are right. It seems that all controls which needs doPostBack was located within user controls with outputcache in my case. – st78 Oct 24 '10 at 17:40
1

Yes it might be about the output cache, comment it out and try again please

Barbaros Alp
  • 6,405
  • 8
  • 47
  • 61
0

Usually this happens when you have malformed javascript somewhere on the page (usually, before the __dopostback function).

Have you viewed the page source and looked to see if the __dopostback function is actually rendered in the page, regardless of whether you're getting the error or not?

Robert C. Barth
  • 22,687
  • 6
  • 45
  • 52