The control type 'System.Web.UI.WebControls.Xml' is not allowed on this page

已答复 The control type 'System.Web.UI.WebControls.Xml' is not allowed on this page

  • 2011年12月12日 6:47
     
     
    Hi All,
    I have place a xml control like below in a WebPart Page through SharePoint Designer 2010.
    It have one xml file and one xslt file.
    <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
    <div>
    <asp:Xml runat="server" id="xmlEmployee"   DocumentSource="file:///C:/Users/Administrator/Desktop/Employee.xml" TransformSource="file:///C:/Users/Administrator/Desktop/Employee.xsl">
    </asp:Xml>
    </div>
    .
    .
    .
    .
    .
    </asp:Content>
    But when i am trying to run the page, following error occur:
    The control type 'System.Web.UI.WebControls.Xml' is not allowed on this page
    Please help in this regards.....
    Thanx in advance

全部回复

  • 2011年12月14日 3:34
    版主
     
     已答复

    Hi ,

     

    I have a test based on your description .When add the XML control directly on the web part page ,it will get the same error message as yours .Or when preview ,it will show ‘Web part error’ .Because this xml control is not a web part .Here is a workaround :

    1.       Add a XML viewer web part on the web part page .

    2.       Choose the web part properties .

    3.       Add the XML file and the xslt file to the web part .Then the page will display the XML file properly .

     

    Thanks

    Entan Ming

    TechNet Community Support

  • 2011年12月20日 2:20
    版主
     
     已答复

    Hi ,

     

    Here is another workaround :

    Add the XML control as safe control in web.config file of the web application .You can find the web.config file here : C:\inetpub\wwwroot\wss\VirtualDirectories .

     

    Find the <SafeControl > tag  and add these lines below :

          <SafeControl Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.WebControls" TypeName="Xml" Safe="True" AllowRemoteDesigner="True" />

     

    Save the web.config file and perform an IIS reset .

     

    Thanks

    Entan Ming

    TechNet Community Support

  • 2011年12月23日 4:59
     
     

    Thanks Entan

    For the last few days i was little bit of busy, so i am not able to reply on your post. Thanks again for your suggestion, i will do what you post and will get back to you if required...

     

     

    Thanks & Regards

    Ayan Choudhury

  • 2012年6月15日 18:27
     
     

    Ayan:

    I have the same issue as you.. what were you able to find out?

    thanks,
    Harry

  • 2012年6月15日 19:32
     
     

    Correction... I edited the web.config and performed the IIS reset. All is well now.

    thanks.

  • 2012年8月8日 15:03
     
     

    Hi,

      I've the same issue.. i edited the web.config and restarted IIS but no help. Can any one help me on this? How can I get more details of this error?

    Also as I'm new to SP, i'd like to ask one more question(Please answer to it even if it seems silly).... When I deploy a webpart developed in VS to a sharepoint site, where is it stored?

    Thanks and Regards

    Praveen.