save the content into  .ascx file, then in your page<%@ Register TagPrefix="mspuc" TagName="SiteHeader" Src="YourFile.ascx" %>....<mspuc:SiteHeader id="SiteHeader1" runat="server" />

解决方案 »

  1.   

    TO  saucer:
        我的这段文字是从数据库里取出来的,不能做死的
      

  2.   

    例如
    string ss = "<Script>alert(1);</script>";
    Response.Write( Page.Server.HtmlEncode( ss )+ "<br>" );
      

  3.   

    TO dragontt(龙人) :
    问题在于从数据库取出来时,并没有"<br>"等HTML标记,回车在数据库里只是空格,所以无从还原
      

  4.   

    use PlaceHolder or LiteralControl
    aspx:
    <asp:PlaceHolder id="ph" runat="Server" /><asp:LiteralControl id="lc" runat="Server" />....
    if you are using code-behind, declare
    protected PlaceHolder ph;
    protected LiteralControl lc;then read from the database,
    ....
    LiteralControl lc2 = new LiteralControl("YourText");
    ph.Controls.Add(lc2);
    lc.Text = "YourText";
      

  5.   

    if your code is plain-text, then doLiteralControl lc2 = new LiteralControl("<PRE>YourText</PRE>");
    ph.Controls.Add(lc2);
    lc.Text = "<PRE>YourText</PRE>";
      

  6.   

    问题已经解决,关键在于数据库里的回车其实是vbCrLf,只要把vbCrLf还原成〈BR〉就可以了。还是感谢大家的帮助!马上结帖!