Thanks.
"Teo Lachev [MVP]" wrote:
> Yes, System.DirectoryServices
>
> --
> Hope this helps.
>
> ---------------------------------------------
> Teo Lachev, MVP [SQL Server], MCSD, MCT
> Author: "Microsoft Reporting Services in Action"
> Publisher website:
http://www.manning.com/lachev > Buy it from Amazon.com:
http://shrinkster.com/eq > Home page and blog:
http://www.prologika.com/ > ---------------------------------------------
>
> "Carlos López." <CarlosLpez@discussions.microsoft.com> wrote in message
> news:BDC8FE37-69C2-4F7C-9437-2660C511A016@microsoft.com...
> > Hi Teo.
> > I try to do that, but i can't write the followin lines of code:
> >
> > Dim ps As New PermissionSet(PermissionState.None)
> > Dim dsp As DirectoryServicesPermission
> >
> > dsp = New
> > DirectoryServicesPermission(DirectoryServicesPermissionAccess.Browse)
> > ps.AddPermission(dsp)
> > ps.Assert()
> >
> > Need import some assembly??
> >
> > Thanks.
> >
> >
> > "Teo Lachev [MVP]" wrote:
> >
> > > Carlos,
> > >
> > > Try this:
> > >
> > > 1. In the rssrvpolicy.config, create a new PermissionSet class
> containing
> > > the DirectoryServicesPermission and associate your assembly with similar
> to
> > > the thread
> > >
>
http://groups.google.com/groups?q=assert+group:*.reportingsvcs+author:teo&hl=en&lr=&selm=ez9iQJqSEHA.1472%40TK2MSFTNGP09.phx.gbl&rnum=1
> > >
> > > or
> > >
> > >
>
http://groups.google.com/groups?hl=en&lr=&threadm=OQe%24dsjhEHA.140%40TK2MSFTNGP12.phx.gbl&rnum=3&prev=/groups%3Fq%3Dpermissionset%2Bassert%2Bgroup:*.reportingsvcs%26hl%3Den%26lr%3D%26selm%3DOQe%2524dsjhEHA.140%2540TK2MSFTNGP12.phx.gbl%26rnum%3D3
> > >
> > > In your case, you won't be using FileIOPermission but
> > > DirectoryServicesPermission
> > >
> > > 2. In your assembly before the FindAll call assert the
> > > DirectoryServicesPermission
> > >
> > > Dim ps As New PermissionSet(PermissionState.None)
> > > Dim dsp As DirectoryServicesPermission
> > >
> > > dsp = New
> > > DirectoryServicesPermission(DirectoryServicesPermissionAccess.Browse)
> > > ps.AddPermission(dsp)
> > >
> > > ' Stop security checks at this point in the stack walk for the specified
> > > permissions
> > > ps.Assert()
> > >
> > > 3. Reading the documentation on DirectorySearcher, you may need to add
> the
> > > AllowPartiallyTrustedCallers attribute to your custom assembly.
> > >
> > >
> > > --
> > > Hope this helps.
> > >
> > > ---------------------------------------------
> > > Teo Lachev, MVP [SQL Server], MCSD, MCT
> > > Author: "Microsoft Reporting Services in Action"
> > > Publisher website:
http://www.manning.com/lachev > > > Buy it from Amazon.com:
http://shrinkster.com/eq > > > Home page and blog:
http://www.prologika.com/ > > > ---------------------------------------------
> > >
> > > "Carlos López." <CarlosLpez@discussions.microsoft.com> wrote in message
> > > news:88509EE6-E92E-4D87-80D7-8F12AE945E13@microsoft.com...
> > > > I'm having a problem using SQL Server Reporting Services in a
> deployment
> > > of a
> > > > project which makes use of an assembly which reads from an Active
> > > Directory
> > > > attribute.
> > > >
> > > > I'm trying to read an Active Directory attribute using a class created
> in
> > > > VB.NET, the following is the code used:
> > > > Public Function GetUserInfo(ByVal inSAM As String, ByVal inType As
> > > > String) As String
> > > > Try
> > > > Dim sPath As String = "LDAP://Dominio" '' Dominio donde se
> > > buscara
> > > > Dim SamAccount As String = Right(inSAM, Len(inSAM) -
> > > InStr(inSAM,
> > > > "\")) ''' Usuario que se buscara
> > > > Dim myDirectory As New DirectoryEntry(sPath,
> "dominio\user",
> > > > "password") 'pass the user account and password for your Enterprise
> admin.
> > > > Dim mySearcher As New DirectorySearcher(myDirectory)
> > > > Dim mySearchResultColl As SearchResultCollection
> > > > Dim mySearchResult As SearchResult
> > > > Dim myResultPropColl As ResultPropertyCollection
> > > > Dim myResultPropValueColl As ResultPropertyValueCollection
> > > > 'Build LDAP query
> > > > mySearcher.Filter = ("(&(objectClass=user)(samaccountname="
> &
> > > > SamAccount & "))")
> > > > mySearchResultColl = mySearcher.FindAll()
> > > > 'I expect only one user from search result
> > > > Select Case mySearchResultColl.Count
> > > > Case 0
> > > > Return "Null"
> > > > Exit Function
> > > > Case Is > 1
> > > > Return "Null"
> > > > Exit Function
> > > > End Select
> > > > 'Get the search result from the collection
> > > > mySearchResult = mySearchResultColl.Item(0)
> > > > 'Get the Properites, they contain the usefull info
> > > > myResultPropColl = mySearchResult.Properties
> > > > 'displayname, mail
> > > > 'Retrieve from the properties collection the display name
> and
> > > > email of the user
> > > > myResultPropValueColl = myResultPropColl.Item(inType)
> > > > Return CStr(myResultPropValueColl.Item(0))
> > > > Catch ex As System.Exception
> > > > 'do some error return here.
> > > > End Try
> > > > End Function
> > > > The class seems work correct in Design View, but when I try to deply,
> a
> > > host
> > > > assembly security error is displayed. I understand one has to modify
> the
> > > > configuration files of Reporting Services en enable correct security,
> > > > (rssrvpolicy.config and rspreviewpolicy.config), I've done this but am
> > > seeing
> > > > the
> > > > same error. Also, I've copied the dll file of the assembly to the /bin
> > > > directory of
> > > > Reporting Serivices and to the Report Designer directory as indicated,
> but
> > > > still no luck with the error.
> > > > Permissions seem to be set correcty in the Virtual Directory of
> Reporting
> > > > Services.
> > > > For the Deployment, I've set up the project properties as follows:
> > > > OverwriteDateSources=True
> > > > TargetFolder=pruebadll
> > > > TargetServerURL=http://lopezcarlos/reportserver
> > > > In the configuration files I've setup in the following manner,
> apparantely
> > > > it's not
> > > > working:
> > > > <CodeGroup
> > > > class="UnionCodeGroup"
> > > > version="1"
> > > > Unrestricted="true"
> > > > PermissionSetName="FullTrust"
> > > > Name="MyCustomAssemblyCodeGroup"
> > > > Description="Codigo especial para leer el active