views:

323

answers:

1

I've run into an issue where a third-party component appears to be interfering with Response.Write and causing any content within Response.Write("") to render before any of the other html. For example:

<html><head><title><% Response.Write("HELLO WORLD") %>

will render as

HELLO WORLD<html><head>...

However, any content rendered using <%= %> blocks will work correctly. The below code will work perfectly:

<html><head><title><%="HELLO WORLD"%>

I always assumed that <%= was simply shorthand for Response.Write. From what I've been able to find on MSDN I now understand that it <%= is eventually converted to Response.Write, but apparently there are a few steps inbetween.

Does anyone have a guess as to why the two would render differently or point me to some documentation/info that explains how <%= %> blocks are handled?

Update: The control that was causing the issue was the Telerik AjaxManager control from the 2009 Q1 release. Upgrading to the Q2 control resolved the problem.

Unfortunately I don't have access to the source so I haven't been able to figure out why the control was causing this behavior. The issue has been resolved but I am still very curious as to why it existed in the first place.

+3  A: 

<%= "foo" %> is turned into Response.Write("foo"); once it is compiled. You can verify this by digging through the ASP.NET Temporary Files folder and using Reflector to decompile the dll's you find.

MatthewMartin