I know this question has been raised before a lot of people, and I have seriously looked at their responses, but no one can solve my problem.
I created a custom web part use default name and namespace. The web part are also automatically deployed. When it was added on the page , I got a messages like 'A Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe.' It have not been solved until now.
My production steps are as follows:
1.Open VS2010 --New project --C# --Sharepoint --2010 --VisualWebPart All the things is default.
2.Add a Lable and a Button in Design mode. When the button is pressed, the lable shows' hello'.
3.Add '[assembly: AllowPartiallyTrustedCallers()]' to the AssemblyInfo.cs
4.Compile and deploy the files. right-click the solution name and click the Build and Deploy.
5.make sure the Web.Config and 'SharePointProjectItem.spdata' have the same config on namespace.
6.open the site , open the page. insert a my web part. And I got the message.I'm not sure my steps are correct, but I really want to know how to solve this problem.