Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net: __doPostBack not rendered sometimes

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?

like image 966
st78 Avatar asked Nov 16 '25 13:11

st78


2 Answers

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)

like image 149
djspark Avatar answered Nov 19 '25 09:11

djspark


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.

like image 32
Diego Mendes Avatar answered Nov 19 '25 10:11

Diego Mendes