I am using a custom assembly. My assembly has to read a particular file and
 take some values from it. I set the required permissions and everything works
 good. However I dont want to hardcode the location of my text file. I decided
 to put the text file in the same location as dll file i.e in ..\Program
 Files\Reporting Services\ReportServer\bin folder and thought of finding the
 path in my class library using something like
 String pathval=System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
 But this method always gives me #Error in my report expression. I also tried
 by removing all other code and just returning the path. Also if I try to
 return System.Reflection.Assembly.GetExecutingAssembly().FullName; it works
 good. I am totally confused as how one property will work and another one
 does not. Is there anything I am missing like setting some reference or
 changing some permission etc.
 I want to know the location of the dll i.e windows path(C:\Program
 Files\Reporting Services\ReportServer\bin) using c# code which will work with
 reporting services.
 Thanks in advance.Probably the exception you are getting is FileIOPermission. If you look at
the Assembly.CodeBase Property topic in BOL, you will see that it requires
FileIOPermission. To confirm this, disable CAS in RS (comment the
<securityPolicy> element in Report Server web.config) and see if it will
execute fine.
See
http://groups.google.com/group/microsoft.public.sqlserver.reportingsvcs/browse_frm/thread/2bd7a109fd6dbe4b/df80503c4773a1b0?lnk=st&q=fileiopermission+assert+group%3A*.reportingsvcs&rnum=1&hl=en#df80503c4773a1b0
or increase the expression CAS policy to FullTrust by changing the
MyComputer GodeGroup in rssrvpolicy.config as follows
 <CodeGroup
 class="FirstMatchCodeGroup"
 version="1"
 PermissionSetName="FullTrust"
 Description="This code group grants
MyComputer code Execution permission. ">
 <IMembershipCondition
 class="ZoneMembershipCondition"
 version="1"
 Zone="MyComputer" />
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"msdnuser" <ringt@.nospam.nospam> wrote in message
news:3469D9D8-469F-4A2C-A7D9-A3CE022FCE72@.microsoft.com...
> I am using a custom assembly. My assembly has to read a particular file
> and
> take some values from it. I set the required permissions and everything
> works
> good. However I dont want to hardcode the location of my text file. I
> decided
> to put the text file in the same location as dll file i.e in ..\Program
> Files\Reporting Services\ReportServer\bin folder and thought of finding
> the
> path in my class library using something like
> String pathval=System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
> But this method always gives me #Error in my report expression. I also
> tried
> by removing all other code and just returning the path. Also if I try to
> return System.Reflection.Assembly.GetExecutingAssembly().FullName; it
> works
> good. I am totally confused as how one property will work and another one
> does not. Is there anything I am missing like setting some reference or
> changing some permission etc.
> I want to know the location of the dll i.e windows path(C:\Program
> Files\Reporting Services\ReportServer\bin) using c# code which will work
> with
> reporting services.
> Thanks in advance.
>
>|||Thanks for Teo's inputs,
Hi Ringt,
I think you can try checking the CAS permission as Teo suggested first. To
temporarly turn off .NET code access security, we can also execute the:
caspol -s off under the VS.NET command console.....
In addition, as for getting assembly path, we don't quite suggest use
codebase since this is not always correctly in some certain scenario (when
assemblies are added into GAC and the original path not in application's
directory...). I think you can also try
AppDomain.BaseDirectory , this will return the base physical location of
our application(if we execute it on the main appdomain......)..
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
| From: "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com>
| References: <3469D9D8-469F-4A2C-A7D9-A3CE022FCE72@.microsoft.com>
| Subject: Re: how to find the windows path of custom assembly using c#
code?
| Date: Tue, 13 Dec 2005 16:27:58 -0500
| Lines: 67
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <e5Y7SwCAGHA.3864@.tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.reportingsvcs
| NNTP-Posting-Host: mail01-ips.ips-sendero.com 12.163.123.194
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.reportingsvcs:64985
| X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
|
| Probably the exception you are getting is FileIOPermission. If you look
at
| the Assembly.CodeBase Property topic in BOL, you will see that it
requires
| FileIOPermission. To confirm this, disable CAS in RS (comment the
| <securityPolicy> element in Report Server web.config) and see if it will
| execute fine.
|
| See
|
http://groups.google.com/group/microsoft.public.sqlserver.reportingsvcs/brow
se_frm/thread/2bd7a109fd6dbe4b/df80503c4773a1b0?lnk=st&q=fileiopermission+as
sert+group%3A*.reportingsvcs&rnum=1&hl=en#df80503c4773a1b0
|
| or increase the expression CAS policy to FullTrust by changing the
| MyComputer GodeGroup in rssrvpolicy.config as follows
| <CodeGroup
| class="FirstMatchCodeGroup"
| version="1"
| PermissionSetName="FullTrust"
| Description="This code group grants
| MyComputer code Execution permission. ">
| <IMembershipCondition
| class="ZoneMembershipCondition"
| version="1"
| Zone="MyComputer" />
|
| --
| HTH,
| ---
| Teo Lachev, MVP, MCSD, MCT
| "Microsoft Reporting Services in Action"
| "Applied Microsoft Analysis Services 2005"
| Home page and blog: http://www.prologika.com/
|
| ---
| "msdnuser" <ringt@.nospam.nospam> wrote in message
| news:3469D9D8-469F-4A2C-A7D9-A3CE022FCE72@.microsoft.com...
| >
| > I am using a custom assembly. My assembly has to read a particular file
| > and
| > take some values from it. I set the required permissions and everything
| > works
| > good. However I dont want to hardcode the location of my text file. I
| > decided
| > to put the text file in the same location as dll file i.e in ..\Program
| > Files\Reporting Services\ReportServer\bin folder and thought of finding
| > the
| > path in my class library using something like
| >
| > String
pathval=System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
| >
| > But this method always gives me #Error in my report expression. I also
| > tried
| > by removing all other code and just returning the path. Also if I try to
| > return System.Reflection.Assembly.GetExecutingAssembly().FullName; it
| > works
| > good. I am totally confused as how one property will work and another
one
| > does not. Is there anything I am missing like setting some reference or
| > changing some permission etc.
| >
| > I want to know the location of the dll i.e windows path(C:\Program
| > Files\Reporting Services\ReportServer\bin) using c# code which will
work
| > with
| > reporting services.
| >
| > Thanks in advance.
| >
| >
| >
|
|
||||Hi Teo and Steven,
Thank you both for the replies. I am able to get the executing path of
assembly using System.AppDomain.CurrentDomain.BaseDirectory only if I give
FullTrust permissionset to "MyComputer" and
"Report_Expressions_Default_Permissions" Code Groups. Is there a way I can
reduce the permission and make them work?
Note: I also have my own permission set and code group to give my dll, read
permission to my text file which is not a config file. I am using Reporting
Services 2005.
Thanks,
ringt|||The links I included in my previous post should get you started although in
your case it is like catch-22. You need to grant access to a path which is
known only at runtime. You have to do some reasearch to find if this is
possible at all.
Good luck!
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"msdnuser" <ringt@.nospam.nospam> wrote in message
news:8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com...
> Hi Teo and Steven,
> Thank you both for the replies. I am able to get the executing path of
> assembly using System.AppDomain.CurrentDomain.BaseDirectory only if I give
> FullTrust permissionset to "MyComputer" and
> "Report_Expressions_Default_Permissions" Code Groups. Is there a way I can
> reduce the permission and make them work?
> Note: I also have my own permission set and code group to give my dll,
> read
> permission to my text file which is not a config file. I am using
> Reporting
> Services 2005.
> Thanks,
> ringt
>|||Hi ringt,
I'm afraid grant the sufficient CAS permission is necessary. However, I
agree with you that it's not necessary to grant the FullTrust to
LocalComputer zone... You can choose to adjust the existing PermissionSet
 , e.g the "Execution" or add a new named PermissionSet and add those
FileIOPermissions in that PermissionSet. To grant the custom PermssionSet
to your own assembly, you can consider strong-named your assemtly so that
you can grant permissionSet through Strong-named condition.....
So far I haven't found any resource directly describing modifying the
reporting service's security policy file, but there is on good article
discussing customize ASP.NET 2.0 security policys:
#How To: Use Code Access Security in ASP.NET 2.0
http://msdn.microsoft.com/library/en-us/dnpag2/html/paght000017.asp?frame=tr
ue
this article mentioned the similiar ideas on customizing existing security
policy file and add FileIOPermission for certain CodeGroup....
Hope helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
| From: "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com>
| References: <3469D9D8-469F-4A2C-A7D9-A3CE022FCE72@.microsoft.com>
<e5Y7SwCAGHA.3864@.tk2msftngp13.phx.gbl>
<P8Vq8jFAGHA.3764@.TK2MSFTNGXA02.phx.gbl>
<8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com>
| Subject: Re: how to find the windows path of custom assembly using c#
code?
| Date: Wed, 14 Dec 2005 21:27:19 -0500
| Lines: 38
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <uiwOM8RAGHA.2040@.TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.reportingsvcs
| NNTP-Posting-Host: c-66-56-76-188.hsd1.ga.comcast.net 66.56.76.188
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.reportingsvcs:65108
| X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
|
| The links I included in my previous post should get you started although
in
| your case it is like catch-22. You need to grant access to a path which
is
| known only at runtime. You have to do some reasearch to find if this is
| possible at all.
|
| Good luck!
|
| --
| HTH,
| ---
| Teo Lachev, MVP, MCSD, MCT
| "Microsoft Reporting Services in Action"
| "Applied Microsoft Analysis Services 2005"
| Home page and blog: http://www.prologika.com/
|
| ---
| "msdnuser" <ringt@.nospam.nospam> wrote in message
| news:8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com...
| > Hi Teo and Steven,
| >
| > Thank you both for the replies. I am able to get the executing path of
| > assembly using System.AppDomain.CurrentDomain.BaseDirectory only if I
give
| > FullTrust permissionset to "MyComputer" and
| > "Report_Expressions_Default_Permissions" Code Groups. Is there a way I
can
| > reduce the permission and make them work?
| >
| > Note: I also have my own permission set and code group to give my dll,
| > read
| > permission to my text file which is not a config file. I am using
| > Reporting
| > Services 2005.
| >
| > Thanks,
| > ringt
| >
| >
|
|
||||Hi there,
As Steven mentioned, I have to give fullTrust permission to get the path
during runtime. Even then as Toe have mentioned asserting permissions to a
path known at runtime is not successful to me. It throws me #Error again. Is
there any other way (even by reducing or modifying some permissions) to
implement this?
Expecting your help.
Thanks.
"Steven Cheng[MSFT]" wrote:
> Hi ringt,
> I'm afraid grant the sufficient CAS permission is necessary. However, I
> agree with you that it's not necessary to grant the FullTrust to
> LocalComputer zone... You can choose to adjust the existing PermissionSet
> , e.g the "Execution" or add a new named PermissionSet and add those
> FileIOPermissions in that PermissionSet. To grant the custom PermssionSet
> to your own assembly, you can consider strong-named your assemtly so that
> you can grant permissionSet through Strong-named condition.....
> So far I haven't found any resource directly describing modifying the
> reporting service's security policy file, but there is on good article
> discussing customize ASP.NET 2.0 security policys:
>
> #How To: Use Code Access Security in ASP.NET 2.0
> http://msdn.microsoft.com/library/en-us/dnpag2/html/paght000017.asp?frame=tr
> ue
> this article mentioned the similiar ideas on customizing existing security
> policy file and add FileIOPermission for certain CodeGroup....
>
> Hope helps. Thanks,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
>
> --
> | From: "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com>
> | References: <3469D9D8-469F-4A2C-A7D9-A3CE022FCE72@.microsoft.com>
> <e5Y7SwCAGHA.3864@.tk2msftngp13.phx.gbl>
> <P8Vq8jFAGHA.3764@.TK2MSFTNGXA02.phx.gbl>
> <8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com>
> | Subject: Re: how to find the windows path of custom assembly using c#
> code?
> | Date: Wed, 14 Dec 2005 21:27:19 -0500
> | Lines: 38
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> | X-RFC2646: Format=Flowed; Original
> | Message-ID: <uiwOM8RAGHA.2040@.TK2MSFTNGP14.phx.gbl>
> | Newsgroups: microsoft.public.sqlserver.reportingsvcs
> | NNTP-Posting-Host: c-66-56-76-188.hsd1.ga.comcast.net 66.56.76.188
> | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
> | Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.reportingsvcs:65108
> | X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
> |
> | The links I included in my previous post should get you started although
> in
> | your case it is like catch-22. You need to grant access to a path which
> is
> | known only at runtime. You have to do some reasearch to find if this is
> | possible at all.
> |
> | Good luck!
> |
> | --
> | HTH,
> | ---
> | Teo Lachev, MVP, MCSD, MCT
> | "Microsoft Reporting Services in Action"
> | "Applied Microsoft Analysis Services 2005"
> | Home page and blog: http://www.prologika.com/
> |
> | ---
> | "msdnuser" <ringt@.nospam.nospam> wrote in message
> | news:8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com...
> | > Hi Teo and Steven,
> | >
> | > Thank you both for the replies. I am able to get the executing path of
> | > assembly using System.AppDomain.CurrentDomain.BaseDirectory only if I
> give
> | > FullTrust permissionset to "MyComputer" and
> | > "Report_Expressions_Default_Permissions" Code Groups. Is there a way I
> can
> | > reduce the permission and make them work?
> | >
> | > Note: I also have my own permission set and code group to give my dll,
> | > read
> | > permission to my text file which is not a config file. I am using
> | > Reporting
> | > Services 2005.
> | >
> | > Thanks,
> | > ringt
> | >
> | >
> |
> |
> |
>|||Hi Teo and Steven,
Please ignore my last reply in this thread. I made a mistake of not
appending my file name after I find the path using
System.AppDomain.CurrentDomain.BaseDirectory. Thus my problem is solved now.
Thank you very much.
"msdnuser" wrote:
> Hi there,
> As Steven mentioned, I have to give fullTrust permission to get the path
> during runtime. Even then as Toe have mentioned asserting permissions to a
> path known at runtime is not successful to me. It throws me #Error again. Is
> there any other way (even by reducing or modifying some permissions) to
> implement this?
> Expecting your help.
> Thanks.
>
> "Steven Cheng[MSFT]" wrote:
> > Hi ringt,
> >
> > I'm afraid grant the sufficient CAS permission is necessary. However, I
> > agree with you that it's not necessary to grant the FullTrust to
> > LocalComputer zone... You can choose to adjust the existing PermissionSet
> > , e.g the "Execution" or add a new named PermissionSet and add those
> > FileIOPermissions in that PermissionSet. To grant the custom PermssionSet
> > to your own assembly, you can consider strong-named your assemtly so that
> > you can grant permissionSet through Strong-named condition.....
> >
> > So far I haven't found any resource directly describing modifying the
> > reporting service's security policy file, but there is on good article
> > discussing customize ASP.NET 2.0 security policys:
> >
> >
> > #How To: Use Code Access Security in ASP.NET 2.0
> > http://msdn.microsoft.com/library/en-us/dnpag2/html/paght000017.asp?frame=tr
> > ue
> >
> > this article mentioned the similiar ideas on customizing existing security
> > policy file and add FileIOPermission for certain CodeGroup....
> >
> >
> > Hope helps. Thanks,
> >
> > Steven Cheng
> > Microsoft Online Support
> >
> > Get Secure! www.microsoft.com/security
> > (This posting is provided "AS IS", with no warranties, and confers no
> > rights.)
> >
> >
> >
> >
> >
> >
> > --
> > | From: "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com>
> > | References: <3469D9D8-469F-4A2C-A7D9-A3CE022FCE72@.microsoft.com>
> > <e5Y7SwCAGHA.3864@.tk2msftngp13.phx.gbl>
> > <P8Vq8jFAGHA.3764@.TK2MSFTNGXA02.phx.gbl>
> > <8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com>
> > | Subject: Re: how to find the windows path of custom assembly using c#
> > code?
> > | Date: Wed, 14 Dec 2005 21:27:19 -0500
> > | Lines: 38
> > | X-Priority: 3
> > | X-MSMail-Priority: Normal
> > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
> > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> > | X-RFC2646: Format=Flowed; Original
> > | Message-ID: <uiwOM8RAGHA.2040@.TK2MSFTNGP14.phx.gbl>
> > | Newsgroups: microsoft.public.sqlserver.reportingsvcs
> > | NNTP-Posting-Host: c-66-56-76-188.hsd1.ga.comcast.net 66.56.76.188
> > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
> > | Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.reportingsvcs:65108
> > | X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
> > |
> > | The links I included in my previous post should get you started although
> > in
> > | your case it is like catch-22. You need to grant access to a path which
> > is
> > | known only at runtime. You have to do some reasearch to find if this is
> > | possible at all.
> > |
> > | Good luck!
> > |
> > | --
> > | HTH,
> > | ---
> > | Teo Lachev, MVP, MCSD, MCT
> > | "Microsoft Reporting Services in Action"
> > | "Applied Microsoft Analysis Services 2005"
> > | Home page and blog: http://www.prologika.com/
> > |
> > | ---
> > | "msdnuser" <ringt@.nospam.nospam> wrote in message
> > | news:8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com...
> > | > Hi Teo and Steven,
> > | >
> > | > Thank you both for the replies. I am able to get the executing path of
> > | > assembly using System.AppDomain.CurrentDomain.BaseDirectory only if I
> > give
> > | > FullTrust permissionset to "MyComputer" and
> > | > "Report_Expressions_Default_Permissions" Code Groups. Is there a way I
> > can
> > | > reduce the permission and make them work?
> > | >
> > | > Note: I also have my own permission set and code group to give my dll,
> > | > read
> > | > permission to my text file which is not a config file. I am using
> > | > Reporting
> > | > Services 2005.
> > | >
> > | > Thanks,
> > | > ringt
> > | >
> > | >
> > |
> > |
> > |
> >
> >|||You're welcome Ringt,
Also, I didn't mean that we have to grant FullTrust permission , but should
grant whatever permission that is necessary for our custom operations. and
for your scenario, this is the FileIOPermission... :-)
Anyway, glad that you've got it working....
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--
| Thread-Topic: how to find the windows path of custom assembly using c#
code?
| thread-index: AcYCXj/lieGZBwSnQZaVOJeA9HQJ8Q==| X-WBNR-Posting-Host: 38.113.18.195
| From: "=?Utf-8?B?bXNkbnVzZXI=?=" <ringt@.nospam.nospam>
| References: <3469D9D8-469F-4A2C-A7D9-A3CE022FCE72@.microsoft.com>
<e5Y7SwCAGHA.3864@.tk2msftngp13.phx.gbl>
<P8Vq8jFAGHA.3764@.TK2MSFTNGXA02.phx.gbl>
<8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com>
<uiwOM8RAGHA.2040@.TK2MSFTNGP14.phx.gbl>
<5s9mSKWAGHA.1504@.TK2MSFTNGXA02.phx.gbl>
<92BCD84D-F5A4-4E8E-AF01-463F71D0FB24@.microsoft.com>
| Subject: Re: how to find the windows path of custom assembly using c#
code?
| Date: Fri, 16 Dec 2005 08:32:04 -0800
| Lines: 131
| Message-ID: <A04C0A67-0357-46A7-B39B-793FBC570C33@.microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.sqlserver.reportingsvcs
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA
03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.reportingsvcs:65287
| X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
|
| Hi Teo and Steven,
|
| Please ignore my last reply in this thread. I made a mistake of not
| appending my file name after I find the path using
| System.AppDomain.CurrentDomain.BaseDirectory. Thus my problem is solved
now.
| Thank you very much.
|
|
|
| "msdnuser" wrote:
|
| > Hi there,
| >
| > As Steven mentioned, I have to give fullTrust permission to get the
path
| > during runtime. Even then as Toe have mentioned asserting permissions
to a
| > path known at runtime is not successful to me. It throws me #Error
again. Is
| > there any other way (even by reducing or modifying some permissions) to
| > implement this?
| >
| > Expecting your help.
| >
| > Thanks.
| >
| >
| >
| > "Steven Cheng[MSFT]" wrote:
| >
| > > Hi ringt,
| > >
| > > I'm afraid grant the sufficient CAS permission is necessary. However,
I
| > > agree with you that it's not necessary to grant the FullTrust to
| > > LocalComputer zone... You can choose to adjust the existing
PermissionSet
| > > , e.g the "Execution" or add a new named PermissionSet and add
those
| > > FileIOPermissions in that PermissionSet. To grant the custom
PermssionSet
| > > to your own assembly, you can consider strong-named your assemtly so
that
| > > you can grant permissionSet through Strong-named condition.....
| > >
| > > So far I haven't found any resource directly describing modifying
the
| > > reporting service's security policy file, but there is on good
article
| > > discussing customize ASP.NET 2.0 security policys:
| > >
| > >
| > > #How To: Use Code Access Security in ASP.NET 2.0
| > >
http://msdn.microsoft.com/library/en-us/dnpag2/html/paght000017.asp?frame=tr
| > > ue
| > >
| > > this article mentioned the similiar ideas on customizing existing
security
| > > policy file and add FileIOPermission for certain CodeGroup....
| > >
| > >
| > > Hope helps. Thanks,
| > >
| > > Steven Cheng
| > > Microsoft Online Support
| > >
| > > Get Secure! www.microsoft.com/security
| > > (This posting is provided "AS IS", with no warranties, and confers no
| > > rights.)
| > >
| > >
| > >
| > >
| > >
| > >
| > > --
| > > | From: "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com>
| > > | References: <3469D9D8-469F-4A2C-A7D9-A3CE022FCE72@.microsoft.com>
| > > <e5Y7SwCAGHA.3864@.tk2msftngp13.phx.gbl>
| > > <P8Vq8jFAGHA.3764@.TK2MSFTNGXA02.phx.gbl>
| > > <8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com>
| > > | Subject: Re: how to find the windows path of custom assembly using
c#
| > > code?
| > > | Date: Wed, 14 Dec 2005 21:27:19 -0500
| > > | Lines: 38
| > > | X-Priority: 3
| > > | X-MSMail-Priority: Normal
| > > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > > | X-RFC2646: Format=Flowed; Original
| > > | Message-ID: <uiwOM8RAGHA.2040@.TK2MSFTNGP14.phx.gbl>
| > > | Newsgroups: microsoft.public.sqlserver.reportingsvcs
| > > | NNTP-Posting-Host: c-66-56-76-188.hsd1.ga.comcast.net 66.56.76.188
| > > | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > > | Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.sqlserver.reportingsvcs:65108
| > > | X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
| > > |
| > > | The links I included in my previous post should get you started
although
| > > in
| > > | your case it is like catch-22. You need to grant access to a path
which
| > > is
| > > | known only at runtime. You have to do some reasearch to find if
this is
| > > | possible at all.
| > > |
| > > | Good luck!
| > > |
| > > | --
| > > | HTH,
| > > | ---
| > > | Teo Lachev, MVP, MCSD, MCT
| > > | "Microsoft Reporting Services in Action"
| > > | "Applied Microsoft Analysis Services 2005"
| > > | Home page and blog: http://www.prologika.com/
| > > |
| > > | ---
| > > | "msdnuser" <ringt@.nospam.nospam> wrote in message
| > > | news:8F143CDF-66BE-4E12-AC74-7322855E18E3@.microsoft.com...
| > > | > Hi Teo and Steven,
| > > | >
| > > | > Thank you both for the replies. I am able to get the executing
path of
| > > | > assembly using System.AppDomain.CurrentDomain.BaseDirectory only
if I
| > > give
| > > | > FullTrust permissionset to "MyComputer" and
| > > | > "Report_Expressions_Default_Permissions" Code Groups. Is there a
way I
| > > can
| > > | > reduce the permission and make them work?
| > > | >
| > > | > Note: I also have my own permission set and code group to give my
dll,
| > > | > read
| > > | > permission to my text file which is not a config file. I am using
| > > | > Reporting
| > > | > Services 2005.
| > > | >
| > > | > Thanks,
| > > | > ringt
| > > | >
| > > | >
| > > |
| > > |
| > > |
| > >
| > >
|
 
No comments:
Post a Comment