You are definitely moving into unsupported waters here. The output of VisitorIdentification
is dependent on a lot of different facors; not the least of which is Robots Detection
.
As far as I can tell; just asking for a rendered output of the control is not going to work, unless prior steps have happened to activate the Tracker
.
I encourage you to share the actual business case you're working to solve here, and open up for a better answer to your question. Until then, this is how you render the above. Use at your own risk.
untested code
using (Sitecore.Web.UI.HtmlControls.Page page = new Sitecore.Web.UI.HtmlControls.Page())
{
System.Web.UI.Control identificationControl = page.LoadControl("~/layouts/system/VisitorIdentification.ascx");
if (identificationControl != null)
{
HtmlForm htmlForm = new HtmlForm();
page.Controls.Add((System.Web.UI.Control) htmlForm);
htmlForm.Controls.Add(identificationControl);
return new HtmlString(HtmlUtil.RenderControl(identificationControl));
}
}
But you might as well just do the following:
output.Write("<link href=\"/layouts/System/VisitorIdentification.aspx\" rel=\"stylesheet\" type=\"text/css\" />");
As nothing in the above; is actually guaranteed to reflect any changes in logic from Sitecore's end. Nor are any cookies written - something the normal VisitorIdentification control would do - and this cannot be captured in a HtmlString
.