So, I'm trying to get the HTML of a Page
using the following code:
var stringWriter = new StringWriter();
var htmlTextWriter = new HtmlTextWriter(stringWriter);
Page.RenderControl(htmlTextWriter);
htmlTextWriter.Flush();
var html = stringWriter.ToString();
This fails with the message Script control 'ace' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors()
.
The control ace
is an AlwaysVisibleControlExtender
from the Ajax Toolkit.
<ajaxToolkit:AlwaysVisibleControlExtender ID="ace" runat="server"
TargetControlID="lblControl" VerticalSide="Middle"
VerticalOffset="50" HorizontalSide="Center" HorizontalOffset="50"
ScrollEffectDuration=".1" />
What's causing this error? How can I get around it? The page works fine when I navigate to it, the problem only occurs when I try to render the HTML to a string.