Sharepoint 2010 register management securely through wsp

I created the "Hello World" Sharepoint 2010 solution using VS2010. It contains only the function and the web part containing the label. I registered the web page as a secure control in the Properties window of the web part in VS2010.

When I deploy my solution on my local server everything works fine! I can add a web page to the page, and in the web.config file, my control is added to the SafeControls list. When I install the same solution on a different server, I can see the web part in the list of available web pages, but when I try to add it to the page, it tells me that it is not registered as safe. When I check the web.config file, there is no entry for my control. If I add one manually (one from my dev server), everything will start working.

Now I am wondering why the control is not registered when I install the wsp file. The manifest inside wsp contains this line:

<Assemblies>
<Assembly Location="abc.TestWebPart.dll" DeploymentTarget="GlobalAssemblyCache">
  <SafeControls>
    <SafeControl Assembly="abc.TestWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e262c75e6f6e8440" Namespace="abc.TestWebPart.VisualWebPart1" TypeName="*" />
  </SafeControls>
</Assembly>

Any ideas are very welcome!

+3
3

.

0

-?

0

Late answer that I know.

I think you are missing "Safe =" TRUE "" in your SafeControl tag.

The correct code is:

<Assemblies>
  <Assembly Location="abc.TestWebPart.dll" DeploymentTarget="GlobalAssemblyCache">
    <SafeControls>
      <SafeControl 
        Assembly="abc.TestWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e262c75e6f6e8440" 
        Namespace="abc.TestWebPart.VisualWebPart1" 
        TypeName="*"
        Safe="TRUE" 
      />
    </SafeControls>
  </Assembly>
</Assemblies>
0
source

Source: https://habr.com/ru/post/1768622/


All Articles