Re: Custom Web Part

From: Greg Merideth (gmerideth.remove_at_this.forwardtechnology.net)
Date: 08/30/04


Date: Mon, 30 Aug 2004 15:31:18 -0400

Somewhere in your web.config you should have a line that reads
<trust level="xxx" originUrl="yyy"/>

That statement sets your working page to a certain trust level. If its minimal
then in your sharepoint folder (depends on wss or sps) (mines in C:\Program
Files\Common Files\Microsoft Shared\web server extensions\60\CONFIG) you will
have wss_mediumtrust.config and a wss_minimaltrust.config (i'm running wss not
sps hence the filenames).

Jason MacKenzie wrote:

> Hi Greg,
>
> Thanks for your response.
>
> "In the webconfig file what is the trust level set to? minimal, medium,
> full?
> If you add your references to the minimal but your web config is using the
> medium one then you can see the problem there."
>
> I'm not sure what this means exactly. Could you clarify it for me? I'm not
> sure where the trust level is set or what "If you add your references to the
> minimal.." means.
>
> Thanks
>
> "Greg Merideth" <gmerideth.remove@this.forwardtechnology.net> wrote in
> message news:PLydnQ942cty967cRVn-gQ@comcast.com...
>
>>Two things to check right off the bat.
>>
>>
>>> <TypeName>SharePointMenuWebPart.WebPartMenu</TypeName>
>>
>>means your namespace is SharePointMenuWebPart and the class name is
>>WebPartMenu, if thats not the case you can get that error.
>>
>>and since you have a token value I assume you've used sn to strongly type
>>the methods?
>>
>>In the webconfig file what is the trust level set to? minimal, medium,
>>full? If you add your references to the minimal but your web config is
>>using the medium one then you can see the problem there.
>>
>>
>>Jason MacKenzie wrote:
>>
>>
>>>I'm attempting to create a custom web part but I'm getting the error:
>>>
>>>"A Web Part or Web Form Control on this Web Part Page cannot be displayed
>>>or imported because it is not registered on this site as safe."
>>>
>>>I want to use our exisiting intranet menu functionality in this web part.
>>>Basically we have some web custom controls that we use to build the menu.
>>>I've added them in my web part code like this:
>>>
>>> Protected Overrides Sub CreateChildControls()
>>> Me.Controls.AddAt(0, LSS)
>>> Me.Controls.AddAt(1, CTMB)
>>> End Sub
>>>
>>>So there are basically three assemblies. My webpart dll and two menu
>>>system related ones. I've copied all three into my
>>>\\SharepointServer\inetpub\wwwroot\bin directory as well as my dwp file
>>>which looks like this:
>>>
>>>
>>><?xml version="1.0" encoding="utf-8"?>
>>><WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
>>> <Title>WebPartMenu</Title>
>>> <Description>WebPartMenu</Description>
>>> <Assembly>SharePointMenuWebPart</Assembly>
>>> <TypeName>SharePointMenuWebPart.WebPartMenu</TypeName>
>>> <!-- Specify initial values for any additional base class or custom
>>>properties here. -->
>>></WebPart>
>>>
>>>
>>>
>>>I've also changed the web.config file in my
>>>\\SharepointServer\inetpub\wwwroot and added the following tags under the
>>>SafeControls element:
>>>
>>>
>>><SafeControl
>>> Assembly="WebPartMenu, Version=1.0.0.0, Culture=neutral,
>>>PublicKeyToken=fce7acfa04aba17c"
>>> Namespace="WebPartMenu"
>>> TypeName="*"
>>> Safe="True"
>>>/>
>>><SafeControl
>>> Assembly="axdIntranet, Version=1.0.0.0, Culture=neutral,
>>>PublicKeyToken=403fa50f8c39f727"
>>> Namespace="CreateMenu"
>>> TypeName="*"
>>> Safe="True"
>>>/>
>>><SafeControl
>>> Assembly="MenuSystem, Version=1.0.1703.16992, Culture=neutral,
>>>PublicKeyToken=53d1c27d1a8fb412"
>>> Namespace="MenuSystem"
>>> TypeName="*"
>>> Safe="True"
>>>/>
>>>
>>>
>>>However when I upload the web Part and try to drag it onto the page I get
>>>the aforementioned error.
>>>
>>>Any idea what else I need to do?
>>>
>>>Thanks a lot,
>>>
>>>Jason MacKenzie
>
>
>



Relevant Pages

  • Re: Urgent: Error While deploying ASP.net application
    ... Actually I am using MySQL database using MySQL ODBC 3.51 Driver. ... I think the trust level medium does not allow database interaction through ... > set the trust level to medium on your development machine to figure out what ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Urgent: Error While deploying ASP.net application
    ... Dominick Baier - DevelopMentor ... I have set trust level to medium on on development machine and found that the pages which are not using database interaction are displaying but pages which interacting with database are giving secrity errror issue. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Urgent: Error While deploying ASP.net application
    ... Stuff like Win32 APIs, COM, EventLog, Registry, File Access outside the web dir is a no go in medium trust. ... To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. ... Then I contacted to hosting support they said their sever is configured to trust level medium. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: reading web.config section
    ... they just repeat and repeat that the server has Medium Level. ... where the security level is Medium. ... and to any config files above it in the same application. ... You may need to set your applications trust level accordingly: ...
    (microsoft.public.dotnet.framework.aspnet)