Thursday, February 11, 2010

Twice calling Render in ASP.NET page

I have web page, which use HtmlTextWriter for creating HTML in client. List<T> get data from DB and start in loop to add HTML tags, attributes and more.  I hoped to create page with div’s, images and text, but in the debug phase i saw the Render() method called twice. After long tests and researches was found out what is a problem. In creating image <img>, a attribute “src” get value from DB and in one images “accidently” a value was …null. You can say “so what?” A problem exist not in HTML page, a problem concealing in IIS. If page has attribute <…src=”” …/> or<… src=”#” …> that makes IIS load the page twice. Good luck!

kick it on

1 comment:

Anonymous said...

Many thanks for this info, had this error, i have been used alot time to locate the problem

Thanks man