I have overriden Sharepoint page's Render method to cut out some script tag from the html sent to client browser like this:
protected override void Render(HtmlTextWriter originalWriter)
{
string content = string.Empty;
using (StringWriter stringWriter = new StringWriter())
{
using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter))
{
//render the page to my temp writer
base.Render(htmlWriter);
htmlWriter.Close();
//get page content that would normally be sent to client
content = stringWriter.ToString();
stringWriter.Close();
}
}
//replace the script tag
Regex regex = new Regex(@"<script>.*RTE_ConvertTextAreaToRichEdit.*<"+"/script>");
content = regex.Replace(content, string.Empty);
//write modified html to the original writer
originalWriter.Write(content);
}
After this change something strange happened: a part of page that usually is in the upper-right corner and says "Welcome XXX" is not displayed properly. When I view the source of the page, this text is writter BEFORE HTML tag - before any html starts. I can't figure out what is going on for last two days.
Have you got any ideas, has anyone had similar problem?