1

I have a SharePoint 2010 and I was asked to fix something on the master page.

I have a very weird issue. The current custom master page is working fine. But when I create a blank master page, copy the code of the current master through SharePoint Designer and make it the default, I get this error:

The control type 'System.Web.UI.WebControls.ListView' is not allowed on this page. The type is not registered as safe.

It is exactly the same code with the working (current) one, I copied it and I compared them, they are the same.

When I remove this bit below, from the masterpage, the error gets resolved. So it's definitely the asp:Listview it is not happy about:

<asp:ListView  runat="server" ID="MenuRepeater" DataSourceID="XXXX">
                    <LayoutTemplate>
                        <div class="secondary-navigation">        
                            <ul>
                                <asp:PlaceHolder runat="server" ID="ItemPlaceholder"/>
                            </ul>
                        </div>
                    </LayoutTemplate>
                    <ItemTemplate>        
                        <li><a class="secondary-navigation-tablink" href="<%# Eval("Url")%>" title="<%# Eval("Description")%>"><%# Eval("Title")%></a></li>
                    </ItemTemplate>
                    <EmptyItemTemplate></EmptyItemTemplate>
                </asp:ListView>                                          

Does anyone know why this could be happening? The two master page files are absolutely the same. The only difference is the new one is created in SharePoint designer and the old one is deployed through a wsp.

This is the bit about assembly registration at the start of master page.

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>

Unfortunately I cannot remove that asp:listview from the page, so I need to make this work. Any suggestions welcome. I am quite baffled why the current one is working but how it does not work when it's copied to a new file. If the control is not safe, it is not safe, so how on earth is the current one working?

  • Why you tried to create a blank master page , try to take a copy from the current master page , I think it's the same what you need ! – Mohamed El-Qassas MVP Jul 18 '16 at 14:40
  • tried that too, no luck. – ova Jul 18 '16 at 14:45
  • I am wondering if it's looking the file under 14 hive, rather than the one I see in SPD (which must be in Database) – ova Jul 18 '16 at 14:46
  • it's not applicable with master page developed by VS – Jihan Jul 18 '16 at 17:13
1

I think the issue is here , as you said

the new one is created in SharePoint designer and the old one is deployed through a wsp.

You should modify your master page via the visual studio then deploy it again . to let this control registered as safe in Web.Config.

you current method only working if master page branded with SP designer, not visual studio.

This control "System.Web.UI.WebControls.ListView" is not registered as safe in the sharePoint designer controls. for the new master page.

Hope I can reach to you what I mean.

  • But this control is already on the current master page, it is not a new addition. so shouldn't it be already registered as safe? I have made no changes, once I realized that creating a new file throws that error, I just went back to see if creating the same file will work, which didn't – ova Jul 18 '16 at 14:57
  • I think the copying operation transfer this control "System.Web.UI.WebControls.ListView" that is not registered as safe in the sharePoint designer control – Mohamed El-Qassas MVP Jul 18 '16 at 15:01
  • unfortunately I have no way to re-deploy it quickly on my current test environment, due to visual studio versions, etc. Is there a way to fix this through SharePoint Designer? How could I make it work without re-deployment.. – ova Jul 18 '16 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.