Saturday, February 25, 2012

Problems with Active Directory

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 directory">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin\MyCustomAssembly.dll" />
</CodeGroup>
In the Property References section of the report, a reference to itself is
made,
and in the preview of Visual Studio .NET 2003 the reports is visualized
correctly.
the problem occurs in the deployment process.
When deployed, the report displays the following error:
Error on loading the host assembly. Details: Security Error
(rsProcessingError)
The following link has the information I've used to do the design of the
report,:
http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
Thanks for the help.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 directory">
> <IMembershipCondition
> class="UrlMembershipCondition"
> version="1"
> Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportServer\bin\MyCustomAssembly.dll" />
> </CodeGroup>
> In the Property References section of the report, a reference to itself is
> made,
> and in the preview of Visual Studio .NET 2003 the reports is visualized
> correctly.
> the problem occurs in the deployment process.
> When deployed, the report displays the following error:
> Error on loading the host assembly. Details: Security Error
> (rsProcessingError)
> The following link has the information I've used to do the design of the
> report,:
> http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
> Thanks for the help.
>|||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 directory">
> > <IMembershipCondition
> > class="UrlMembershipCondition"
> > version="1"
> > Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> > Services\ReportServer\bin\MyCustomAssembly.dll" />
> > </CodeGroup>
> > In the Property References section of the report, a reference to itself is
> > made,
> > and in the preview of Visual Studio .NET 2003 the reports is visualized
> > correctly.
> > the problem occurs in the deployment process.
> > When deployed, the report displays the following error:
> > Error on loading the host assembly. Details: Security Error
> > (rsProcessingError)
> >
> > The following link has the information I've used to do the design of the
> > report,:
> > http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
> > Thanks for the help.
> >
>
>|||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
directory">
> > > <IMembershipCondition
> > > class="UrlMembershipCondition"
> > > version="1"
> > > Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> > > Services\ReportServer\bin\MyCustomAssembly.dll" />
> > > </CodeGroup>
> > > In the Property References section of the report, a reference to
itself is
> > > made,
> > > and in the preview of Visual Studio .NET 2003 the reports is
visualized
> > > correctly.
> > > the problem occurs in the deployment process.
> > > When deployed, the report displays the following error:
> > > Error on loading the host assembly. Details: Security Error
> > > (rsProcessingError)
> > >
> > > The following link has the information I've used to do the design of
the
> > > report,:
> > > http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
> > > Thanks for the help.
> > >
> >
> >
> >|||Thanks Teo,
This imports (System.DirectoryServices), i already ve added to the project,
but dont solve my problem, can i send my project files?.
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
> directory">
> > > > <IMembershipCondition
> > > > class="UrlMembershipCondition"
> > > > version="1"
> > > > Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> > > > Services\ReportServer\bin\MyCustomAssembly.dll" />
> > > > </CodeGroup>
> > > > In the Property References section of the report, a reference to
> itself is
> > > > made,
> > > > and in the preview of Visual Studio .NET 2003 the reports is
> visualized
> > > > correctly.
> > > > the problem occurs in the deployment process.
> > > > When deployed, the report displays the following error:
> > > > Error on loading the host assembly. Details: Security Error
> > > > (rsProcessingError)
> > > >
> > > > The following link has the information I've used to do the design of
> the
> > > > report,:
> > > > http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
> > > > Thanks for the help.
> > > >
> > >
> > >
> > >
>
>|||What is the problem? You cannot compile the project?
--
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:2F19F79D-5A5B-4971-86F2-5F2B635090C7@.microsoft.com...
> Thanks Teo,
> This imports (System.DirectoryServices), i already ve added to the
project,
> but dont solve my problem, can i send my project files?.
> 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
> > directory">
> > > > > <IMembershipCondition
> > > > > class="UrlMembershipCondition"
> > > > > version="1"
> > > > > Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> > > > > Services\ReportServer\bin\MyCustomAssembly.dll" />
> > > > > </CodeGroup>
> > > > > In the Property References section of the report, a reference to
> > itself is
> > > > > made,
> > > > > and in the preview of Visual Studio .NET 2003 the reports is
> > visualized
> > > > > correctly.
> > > > > the problem occurs in the deployment process.
> > > > > When deployed, the report displays the following error:
> > > > > Error on loading the host assembly. Details: Security Error
> > > > > (rsProcessingError)
> > > > >
> > > > > The following link has the information I've used to do the design
of
> > the
> > > > > report,:
> > > > > http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
> > > > > Thanks for the help.
> > > > >
> > > >
> > > >
> > > >
> >
> >
> >|||OK, send me the project to have a look. You can send it to my e-mail address
by removing nospam.
--
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:2F19F79D-5A5B-4971-86F2-5F2B635090C7@.microsoft.com...
> Thanks Teo,
> This imports (System.DirectoryServices), i already ve added to the
project,
> but dont solve my problem, can i send my project files?.
> 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
> > directory">
> > > > > <IMembershipCondition
> > > > > class="UrlMembershipCondition"
> > > > > version="1"
> > > > > Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> > > > > Services\ReportServer\bin\MyCustomAssembly.dll" />
> > > > > </CodeGroup>
> > > > > In the Property References section of the report, a reference to
> > itself is
> > > > > made,
> > > > > and in the preview of Visual Studio .NET 2003 the reports is
> > visualized
> > > > > correctly.
> > > > > the problem occurs in the deployment process.
> > > > > When deployed, the report displays the following error:
> > > > > Error on loading the host assembly. Details: Security Error
> > > > > (rsProcessingError)
> > > > >
> > > > > The following link has the information I've used to do the design
of
> > the
> > > > > report,:
> > > > > http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
> > > > > Thanks for the help.
> > > > >
> > > >
> > > >
> > > >
> >
> >
> >|||Hi Teo.
Tanks by your attention!
I Have another problem, i try to access an oracle database from a custom
assembly, in desing view all work nice, but in prodction environment, the
call to tha class fall!.
What i can do to correct this problem?
Thanks!
"Teo Lachev [MVP]" wrote:
> OK, send me the project to have a look. You can send it to my e-mail address
> by removing nospam.
> --
> 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:2F19F79D-5A5B-4971-86F2-5F2B635090C7@.microsoft.com...
> > Thanks Teo,
> > This imports (System.DirectoryServices), i already ve added to the
> project,
> > but dont solve my problem, can i send my project files?.
> >
> > 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
> > > directory">
> > > > > > <IMembershipCondition
> > > > > > class="UrlMembershipCondition"
> > > > > > version="1"
> > > > > > Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> > > > > > Services\ReportServer\bin\MyCustomAssembly.dll" />
> > > > > > </CodeGroup>
> > > > > > In the Property References section of the report, a reference to
> > > itself is
> > > > > > made,
> > > > > > and in the preview of Visual Studio .NET 2003 the reports is
> > > visualized
> > > > > > correctly.
> > > > > > the problem occurs in the deployment process.
> > > > > > When deployed, the report displays the following error:
> > > > > > Error on loading the host assembly. Details: Security Error
> > > > > > (rsProcessingError)
> > > > > >
> > > > > > The following link has the information I've used to do the design
> of
> > > the
> > > > > > report,:
> > > > > > http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
> > > > > > Thanks for the help.
> > > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>|||Carlos,
Please review the following thread:
http://groups.google.com/groups?hl=en&lr=&threadm=%23ppSwoScEHA.4092%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fas_q%3Doracle%2520assembly%26safe%3Dimages%26as_ugroup%3D*.reportingsvcs%26lr%3D%26hl%3Den
--
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:01FBDA93-AA78-43BD-A589-19A71BE83AE3@.microsoft.com...
> Hi Teo.
> Tanks by your attention!
> I Have another problem, i try to access an oracle database from a custom
> assembly, in desing view all work nice, but in prodction environment, the
> call to tha class fall!.
> What i can do to correct this problem?
> Thanks!
> "Teo Lachev [MVP]" wrote:
> > OK, send me the project to have a look. You can send it to my e-mail
address
> > by removing nospam.
> >
> > --
> > 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:2F19F79D-5A5B-4971-86F2-5F2B635090C7@.microsoft.com...
> > > Thanks Teo,
> > > This imports (System.DirectoryServices), i already ve added to the
> > project,
> > > but dont solve my problem, can i send my project files?.
> > >
> > > 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
> > > > directory">
> > > > > > > <IMembershipCondition
> > > > > > > class="UrlMembershipCondition"
> > > > > > > version="1"
> > > > > > > Url="E:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> > > > > > > Services\ReportServer\bin\MyCustomAssembly.dll" />
> > > > > > > </CodeGroup>
> > > > > > > In the Property References section of the report, a reference
to
> > > > itself is
> > > > > > > made,
> > > > > > > and in the preview of Visual Studio .NET 2003 the reports is
> > > > visualized
> > > > > > > correctly.
> > > > > > > the problem occurs in the deployment process.
> > > > > > > When deployed, the report displays the following error:
> > > > > > > Error on loading the host assembly. Details: Security Error
> > > > > > > (rsProcessingError)
> > > > > > >
> > > > > > > The following link has the information I've used to do the
design
> > of
> > > > the
> > > > > > > report,:
> > > > > > > http://blogs.sqlxml.org/bryantlikes/articles/824.aspx
> > > > > > > Thanks for the help.
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> >
> >
> >

No comments:

Post a Comment