473,662 Members | 2,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom CodeAccessSecur ityAttribute

I try to make a custom CodeAccessSecur ityAttribute, but hit the wall at
every corner.

I created a simple custom security attribute, which is working (see below).
But...
1) I have to put the assembly in "C:\Program Files\Microsoft Visual Studio
..NET 2003\Common7\ID E": shoudn't it be the application's directory instead?
2) I'm unable to debug it.

Any clues as how to change the required directory and how to debug the
assembly?

(The goal is, in the end, to access a database in the attribute.)

Thanks!

Martin

==== Code ====

[AttributeUsage( AttributeTarget s.Method)]
public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute
{
public CustomPermissio nAttribute(Secu rityAction action)
: base(action)
{}
public override IPermission CreatePermissio n()
{ return new PrincipalPermis sion("john", "role"); }
}
Nov 15 '05 #1
8 5022
Martin -
the right thing to do is to put the assembly containing attribute
implementation in the GAC and add it to the fully trusted assemblies list
(caspol -af).
Hope this helps.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This message is provided "AS IS" with no warranties, and confers no rights.
"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:Op******** ******@TK2MSFTN GP12.phx.gbl...
I try to make a custom CodeAccessSecur ityAttribute, but hit the wall at
every corner.

I created a simple custom security attribute, which is working (see below). But...
1) I have to put the assembly in "C:\Program Files\Microsoft Visual Studio
.NET 2003\Common7\ID E": shoudn't it be the application's directory instead? 2) I'm unable to debug it.

Any clues as how to change the required directory and how to debug the
assembly?

(The goal is, in the end, to access a database in the attribute.)

Thanks!

Martin

==== Code ====

[AttributeUsage( AttributeTarget s.Method)]
public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute
{
public CustomPermissio nAttribute(Secu rityAction action)
: base(action)
{}
public override IPermission CreatePermissio n()
{ return new PrincipalPermis sion("john", "role"); }
}

Nov 15 '05 #2
Thanks, but do you know how I can debug such an assembly ?

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
Martin -
the right thing to do is to put the assembly containing attribute
implementation in the GAC and add it to the fully trusted assemblies list
(caspol -af).
Hope this helps.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This message is provided "AS IS" with no warranties, and confers no rights.

"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:Op******** ******@TK2MSFTN GP12.phx.gbl...
I try to make a custom CodeAccessSecur ityAttribute, but hit the wall at
every corner.

I created a simple custom security attribute, which is working (see

below).
But...
1) I have to put the assembly in "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\ID E": shoudn't it be the application's directory

instead?
2) I'm unable to debug it.

Any clues as how to change the required directory and how to debug the
assembly?

(The goal is, in the end, to access a database in the attribute.)

Thanks!

Martin

==== Code ====

[AttributeUsage( AttributeTarget s.Method)]
public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute
{
public CustomPermissio nAttribute(Secu rityAction action)
: base(action)
{}
public override IPermission CreatePermissio n()
{ return new PrincipalPermis sion("john", "role"); }
}


Nov 15 '05 #3
Martin -
what debugging problems are you having? Do you have the rigth debug symbols
at the right place? Are you using VS or cordbg?
--Ivan
http://blogs.gotdotnet.com/ivanmed
This message is provided "AS IS" with no warranties, and confers no rights.
"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
Thanks, but do you know how I can debug such an assembly ?

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
Martin -
the right thing to do is to put the assembly containing attribute
implementation in the GAC and add it to the fully trusted assemblies list
(caspol -af).
Hope this helps.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This message is provided "AS IS" with no warranties, and confers no

rights.


"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:Op******** ******@TK2MSFTN GP12.phx.gbl...
I try to make a custom CodeAccessSecur ityAttribute, but hit the wall at every corner.

I created a simple custom security attribute, which is working (see

below).
But...
1) I have to put the assembly in "C:\Program Files\Microsoft Visual

Studio .NET 2003\Common7\ID E": shoudn't it be the application's directory

instead?
2) I'm unable to debug it.

Any clues as how to change the required directory and how to debug the
assembly?

(The goal is, in the end, to access a database in the attribute.)

Thanks!

Martin

==== Code ====

[AttributeUsage( AttributeTarget s.Method)]
public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute
{
public CustomPermissio nAttribute(Secu rityAction action)
: base(action)
{}
public override IPermission CreatePermissio n()
{ return new PrincipalPermis sion("john", "role"); }
}



Nov 15 '05 #4
I use VS and the attribute is in the GAC (I can see that its code is
executed). But I can't step-in the code of the attribute assembly. It's kind
of called by the framework somewhere. I need to be able to debug the
attribute assembly to add more sophisticated code. Do you know how to debug
that assembly?

Thanks again for any help!

PS: Right now, I'm testing with a pretty basic attribute:

[AttributeUsage( AttributeTarget s.Method)]
public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute
{
public CustomPermissio nAttribute(Secu rityAction action)
: base(action)
{
}

public override IPermission CreatePermissio n()
{
return new PrincipalPermis sion("User");
}
}

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:OZ******** ********@TK2MSF TNGP12.phx.gbl. ..
Martin -
what debugging problems are you having? Do you have the rigth debug symbols at the right place? Are you using VS or cordbg?
--Ivan
http://blogs.gotdotnet.com/ivanmed
This message is provided "AS IS" with no warranties, and confers no rights.

"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
Thanks, but do you know how I can debug such an assembly ?

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
Martin -
the right thing to do is to put the assembly containing attribute
implementation in the GAC and add it to the fully trusted assemblies list (caspol -af).
Hope this helps.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This message is provided "AS IS" with no warranties, and confers no

rights.


"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:Op******** ******@TK2MSFTN GP12.phx.gbl...
> I try to make a custom CodeAccessSecur ityAttribute, but hit the wall at > every corner.
>
> I created a simple custom security attribute, which is working (see
below).
> But...
> 1) I have to put the assembly in "C:\Program Files\Microsoft Visual

Studio
> .NET 2003\Common7\ID E": shoudn't it be the application's directory
instead?
> 2) I'm unable to debug it.
>
> Any clues as how to change the required directory and how to debug the > assembly?
>
> (The goal is, in the end, to access a database in the attribute.)
>
> Thanks!
>
> Martin
>
> ==== Code ====
>
> [AttributeUsage( AttributeTarget s.Method)]
> public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute > {
> public CustomPermissio nAttribute(Secu rityAction action)
> : base(action)
> {}
> public override IPermission CreatePermissio n()
> { return new PrincipalPermis sion("john", "role"); }
> }
>
>



Nov 15 '05 #5
Martin -
you won't be able to step-in because there is no explicit call into the
attribute code. Try setting a breakpoint and then starting the process being
debugger. In the 'Modules' window make sure the debug symbols are loaded for
the module containing the attribute implementation.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This posting is provided "AS IS" with no warranties, and confers no rights

"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:O2******** ********@TK2MSF TNGP09.phx.gbl. ..
I use VS and the attribute is in the GAC (I can see that its code is
executed). But I can't step-in the code of the attribute assembly. It's kind of called by the framework somewhere. I need to be able to debug the
attribute assembly to add more sophisticated code. Do you know how to debug that assembly?

Thanks again for any help!

PS: Right now, I'm testing with a pretty basic attribute:

[AttributeUsage( AttributeTarget s.Method)]
public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute
{
public CustomPermissio nAttribute(Secu rityAction action)
: base(action)
{
}

public override IPermission CreatePermissio n()
{
return new PrincipalPermis sion("User");
}
}

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:OZ******** ********@TK2MSF TNGP12.phx.gbl. ..
Martin -
what debugging problems are you having? Do you have the rigth debug

symbols
at the right place? Are you using VS or cordbg?
--Ivan
http://blogs.gotdotnet.com/ivanmed
This message is provided "AS IS" with no warranties, and confers no

rights.


"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
Thanks, but do you know how I can debug such an assembly ?

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
> Martin -
> the right thing to do is to put the assembly containing attribute
> implementation in the GAC and add it to the fully trusted assemblies

list
> (caspol -af).
> Hope this helps.
> --Ivan
> http://blogs.gotdotnet.com/ivanmed
> This message is provided "AS IS" with no warranties, and confers no
rights.
>
>
> "Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
> news:Op******** ******@TK2MSFTN GP12.phx.gbl...
> > I try to make a custom CodeAccessSecur ityAttribute, but hit the wall
at
> > every corner.
> >
> > I created a simple custom security attribute, which is working
(see > below).
> > But...
> > 1) I have to put the assembly in "C:\Program Files\Microsoft Visual Studio
> > .NET 2003\Common7\ID E": shoudn't it be the application's directory
> instead?
> > 2) I'm unable to debug it.
> >
> > Any clues as how to change the required directory and how to debug

the > > assembly?
> >
> > (The goal is, in the end, to access a database in the attribute.)
> >
> > Thanks!
> >
> > Martin
> >
> > ==== Code ====
> >
> > [AttributeUsage( AttributeTarget s.Method)]
> > public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute > > {
> > public CustomPermissio nAttribute(Secu rityAction action)
> > : base(action)
> > {}
> > public override IPermission CreatePermissio n()
> > { return new PrincipalPermis sion("john", "role"); }
> > }
> >
> >
>
>



Nov 15 '05 #6
Ivan, we're getting closer, but it's not working: I've made sure to load the
module; I've even added a static method to the attribute that I call before
using the attribute (I can step into that method). BUT I can't step in the
instance method (breakpoints can be set but don't work). The feeling I have
is that for security, the assembly containing the attribute is loaded by the
framework in some other process (???).

I also tried asserting the method to find my way in, but noting came up.

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:eE******** ******@TK2MSFTN GP12.phx.gbl...
Martin -
you won't be able to step-in because there is no explicit call into the
attribute code. Try setting a breakpoint and then starting the process being debugger. In the 'Modules' window make sure the debug symbols are loaded for the module containing the attribute implementation.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This posting is provided "AS IS" with no warranties, and confers no rights

"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:O2******** ********@TK2MSF TNGP09.phx.gbl. ..
I use VS and the attribute is in the GAC (I can see that its code is
executed). But I can't step-in the code of the attribute assembly. It's

kind
of called by the framework somewhere. I need to be able to debug the
attribute assembly to add more sophisticated code. Do you know how to

debug
that assembly?

Thanks again for any help!

PS: Right now, I'm testing with a pretty basic attribute:

[AttributeUsage( AttributeTarget s.Method)]
public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute
{
public CustomPermissio nAttribute(Secu rityAction action)
: base(action)
{
}

public override IPermission CreatePermissio n()
{
return new PrincipalPermis sion("User");
}
}

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:OZ******** ********@TK2MSF TNGP12.phx.gbl. ..
Martin -
what debugging problems are you having? Do you have the rigth debug

symbols
at the right place? Are you using VS or cordbg?
--Ivan
http://blogs.gotdotnet.com/ivanmed
This message is provided "AS IS" with no warranties, and confers no

rights.


"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
> Thanks, but do you know how I can debug such an assembly ?
>
> "Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
> news:OX******** ******@TK2MSFTN GP10.phx.gbl...
> > Martin -
> > the right thing to do is to put the assembly containing attribute
> > implementation in the GAC and add it to the fully trusted assemblies list
> > (caspol -af).
> > Hope this helps.
> > --Ivan
> > http://blogs.gotdotnet.com/ivanmed
> > This message is provided "AS IS" with no warranties, and confers no > rights.
> >
> >
> > "Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
> > news:Op******** ******@TK2MSFTN GP12.phx.gbl...
> > > I try to make a custom CodeAccessSecur ityAttribute, but hit the wall at
> > > every corner.
> > >
> > > I created a simple custom security attribute, which is working (see > > below).
> > > But...
> > > 1) I have to put the assembly in "C:\Program Files\Microsoft Visual > Studio
> > > .NET 2003\Common7\ID E": shoudn't it be the application's directory > > instead?
> > > 2) I'm unable to debug it.
> > >
> > > Any clues as how to change the required directory and how to debug
the
> > > assembly?
> > >
> > > (The goal is, in the end, to access a database in the

attribute.) > > >
> > > Thanks!
> > >
> > > Martin
> > >
> > > ==== Code ====
> > >
> > > [AttributeUsage( AttributeTarget s.Method)]
> > > public class CustomPermissio nAttribute :

CodeAccessSecur ityAttribute
> > > {
> > > public CustomPermissio nAttribute(Secu rityAction action)
> > > : base(action)
> > > {}
> > > public override IPermission CreatePermissio n()
> > > { return new PrincipalPermis sion("john", "role"); }
> > > }
> > >
> > >
> >
> >
>
>



Nov 15 '05 #7
Well, that will probably be my last comment on this. I've added a file trace
in the attribute. The funny thing is that the trace is written to the file
when the assembly that uses the attribute is COMPILED. My conclusion is that
the *code access security* attribute is tested between the assemblies at
compile time and not at runtime, and that all the appropriate security info
is set in the using assembly's metadata. I guess that if I want to debug the
attribute dll, I have to use the compiler as the executing process. Far too
much trouble for what I need. Weird issue.

Martin

"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:Oo******** ******@tk2msftn gp13.phx.gbl...
Ivan, we're getting closer, but it's not working: I've made sure to load the module; I've even added a static method to the attribute that I call before using the attribute (I can step into that method). BUT I can't step in the
instance method (breakpoints can be set but don't work). The feeling I have is that for security, the assembly containing the attribute is loaded by the framework in some other process (???).

I also tried asserting the method to find my way in, but noting came up.

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:eE******** ******@TK2MSFTN GP12.phx.gbl...
Martin -
you won't be able to step-in because there is no explicit call into the
attribute code. Try setting a breakpoint and then starting the process

being
debugger. In the 'Modules' window make sure the debug symbols are loaded

for
the module containing the attribute implementation.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This posting is provided "AS IS" with no warranties, and confers no rights

"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:O2******** ********@TK2MSF TNGP09.phx.gbl. ..
I use VS and the attribute is in the GAC (I can see that its code is
executed). But I can't step-in the code of the attribute assembly. It's
kind
of called by the framework somewhere. I need to be able to debug the
attribute assembly to add more sophisticated code. Do you know how to

debug
that assembly?

Thanks again for any help!

PS: Right now, I'm testing with a pretty basic attribute:

[AttributeUsage( AttributeTarget s.Method)]
public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute
{
public CustomPermissio nAttribute(Secu rityAction action)
: base(action)
{
}

public override IPermission CreatePermissio n()
{
return new PrincipalPermis sion("User");
}
}

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:OZ******** ********@TK2MSF TNGP12.phx.gbl. ..
> Martin -
> what debugging problems are you having? Do you have the rigth debug
symbols
> at the right place? Are you using VS or cordbg?
> --Ivan
> http://blogs.gotdotnet.com/ivanmed
> This message is provided "AS IS" with no warranties, and confers no
rights.
>
>
> "Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
> news:eF******** ******@TK2MSFTN GP12.phx.gbl...
> > Thanks, but do you know how I can debug such an assembly ?
> >
> > "Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in
message > > news:OX******** ******@TK2MSFTN GP10.phx.gbl...
> > > Martin -
> > > the right thing to do is to put the assembly containing attribute > > > implementation in the GAC and add it to the fully trusted

assemblies > list
> > > (caspol -af).
> > > Hope this helps.
> > > --Ivan
> > > http://blogs.gotdotnet.com/ivanmed
> > > This message is provided "AS IS" with no warranties, and confers no > > rights.
> > >
> > >
> > > "Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
> > > news:Op******** ******@TK2MSFTN GP12.phx.gbl...
> > > > I try to make a custom CodeAccessSecur ityAttribute, but hit
the wall
> at
> > > > every corner.
> > > >
> > > > I created a simple custom security attribute, which is working

(see
> > > below).
> > > > But...
> > > > 1) I have to put the assembly in "C:\Program Files\Microsoft

Visual
> > Studio
> > > > .NET 2003\Common7\ID E": shoudn't it be the application's

directory > > > instead?
> > > > 2) I'm unable to debug it.
> > > >
> > > > Any clues as how to change the required directory and how to debug the
> > > > assembly?
> > > >
> > > > (The goal is, in the end, to access a database in the attribute.) > > > >
> > > > Thanks!
> > > >
> > > > Martin
> > > >
> > > > ==== Code ====
> > > >
> > > > [AttributeUsage( AttributeTarget s.Method)]
> > > > public class CustomPermissio nAttribute :
CodeAccessSecur ityAttribute
> > > > {
> > > > public CustomPermissio nAttribute(Secu rityAction action)
> > > > : base(action)
> > > > {}
> > > > public override IPermission CreatePermissio n()
> > > > { return new PrincipalPermis sion("john", "role"); }
> > > > }
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #8
Martin -
what you are observing is expected. The declarative security attributes are
stored in the assembly metadata in the xml format, which gets created at the
compile time, so the contructor and the ToXml-related code is being invoked
at the compile time. At the run time the attribute is being read,
de-serialized and the right permission object is created.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This posting is provided "AS IS" with no warranties, and confers no rights
"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:OW******** ******@tk2msftn gp13.phx.gbl...
Well, that will probably be my last comment on this. I've added a file trace in the attribute. The funny thing is that the trace is written to the file
when the assembly that uses the attribute is COMPILED. My conclusion is that the *code access security* attribute is tested between the assemblies at
compile time and not at runtime, and that all the appropriate security info is set in the using assembly's metadata. I guess that if I want to debug the attribute dll, I have to use the compiler as the executing process. Far too much trouble for what I need. Weird issue.

Martin

"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:Oo******** ******@tk2msftn gp13.phx.gbl...
Ivan, we're getting closer, but it's not working: I've made sure to load

the
module; I've even added a static method to the attribute that I call

before
using the attribute (I can step into that method). BUT I can't step in the
instance method (breakpoints can be set but don't work). The feeling I

have
is that for security, the assembly containing the attribute is loaded by

the
framework in some other process (???).

I also tried asserting the method to find my way in, but noting came up.

"Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
news:eE******** ******@TK2MSFTN GP12.phx.gbl...
Martin -
you won't be able to step-in because there is no explicit call into the attribute code. Try setting a breakpoint and then starting the process

being
debugger. In the 'Modules' window make sure the debug symbols are loaded
for
the module containing the attribute implementation.
--Ivan
http://blogs.gotdotnet.com/ivanmed
This posting is provided "AS IS" with no warranties, and confers no rights
"Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
news:O2******** ********@TK2MSF TNGP09.phx.gbl. ..
> I use VS and the attribute is in the GAC (I can see that its code is
> executed). But I can't step-in the code of the attribute assembly. It's kind
> of called by the framework somewhere. I need to be able to debug the
> attribute assembly to add more sophisticated code. Do you know how
to debug
> that assembly?
>
> Thanks again for any help!
>
> PS: Right now, I'm testing with a pretty basic attribute:
>
> [AttributeUsage( AttributeTarget s.Method)]
> public class CustomPermissio nAttribute : CodeAccessSecur ityAttribute > {
> public CustomPermissio nAttribute(Secu rityAction action)
> : base(action)
> {
> }
>
> public override IPermission CreatePermissio n()
> {
> return new PrincipalPermis sion("User");
> }
> }
>
> "Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in message
> news:OZ******** ********@TK2MSF TNGP12.phx.gbl. ..
> > Martin -
> > what debugging problems are you having? Do you have the rigth debug > symbols
> > at the right place? Are you using VS or cordbg?
> > --Ivan
> > http://blogs.gotdotnet.com/ivanmed
> > This message is provided "AS IS" with no warranties, and confers no > rights.
> >
> >
> > "Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
> > news:eF******** ******@TK2MSFTN GP12.phx.gbl...
> > > Thanks, but do you know how I can debug such an assembly ?
> > >
> > > "Ivan Medvedev [MS]" <iv*****@online .microsoft.com> wrote in

message > > > news:OX******** ******@TK2MSFTN GP10.phx.gbl...
> > > > Martin -
> > > > the right thing to do is to put the assembly containing attribute > > > > implementation in the GAC and add it to the fully trusted

assemblies
> > list
> > > > (caspol -af).
> > > > Hope this helps.
> > > > --Ivan
> > > > http://blogs.gotdotnet.com/ivanmed
> > > > This message is provided "AS IS" with no warranties, and confers no
> > > rights.
> > > >
> > > >
> > > > "Martin Lapierre" <la*******@cedr om-sni.com> wrote in message
> > > > news:Op******** ******@TK2MSFTN GP12.phx.gbl...
> > > > > I try to make a custom CodeAccessSecur ityAttribute, but hit the wall
> > at
> > > > > every corner.
> > > > >
> > > > > I created a simple custom security attribute, which is

working (see
> > > > below).
> > > > > But...
> > > > > 1) I have to put the assembly in "C:\Program Files\Microsoft
Visual
> > > Studio
> > > > > .NET 2003\Common7\ID E": shoudn't it be the application's

directory
> > > > instead?
> > > > > 2) I'm unable to debug it.
> > > > >
> > > > > Any clues as how to change the required directory and how to

debug
> the
> > > > > assembly?
> > > > >
> > > > > (The goal is, in the end, to access a database in the

attribute.)
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Martin
> > > > >
> > > > > ==== Code ====
> > > > >
> > > > > [AttributeUsage( AttributeTarget s.Method)]
> > > > > public class CustomPermissio nAttribute :
> CodeAccessSecur ityAttribute
> > > > > {
> > > > > public CustomPermissio nAttribute(Secu rityAction action)
> > > > > : base(action)
> > > > > {}
> > > > > public override IPermission CreatePermissio n()
> > > > > { return new PrincipalPermis sion("john", "role"); }
> > > > > }
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1467
by: Nick | last post by:
My client uses a SQL Database to store their usernames and passwords, and I do not believe they have AD...no big deal... I wrote a class to create a generic identity and generic principal so that I can use the .IsInRole function for some added security. I would like to do the same by applying an attribute to a method or class. The code I am including works from what I can see, but I am experiencing the following... 1) I cannot add the...
5
2536
by: Graham | last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider" that derives from "MembershipProvider". This providor is located in a Businesslogic layer dll called "Enlighten.LinkMad.Businesslogic". In one of my frontend websites I use this type to authenticate a user who is trying to login. The following excerpt is from the web.config of the particular site showing the reference to the custom provider, allowing .Net to do...
2
2578
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
0
1223
by: Willem van Rumpt | last post by:
Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <OOtt3CadGHA.3632@TK2MSFTNGP05.phx.gbl> Newsgroups: microsoft.public.dotnet.languages.csharp NNTP-Posting-Host: kooijma1.dsl.vianetworks.nl 212.61.93.147 Lines: 1 Path:...
27
45539
by: Wayne | last post by:
I've been clicking around Access 2007 Beta 2 and can't see the custom menu bar designer. Is it in the beta? Maybe I'm blind. The question that comes to mind is: Will custom menu bars be the same height as they were in previous versions or will they be the "ribbon" style that takes up a huge portion of the screen? Also when I use Access 2007 to open an Access 2003 database that has custom menu bars they display as they did in Access...
15
6506
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
2
19457
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
1
4376
by: asharda | last post by:
I have a custom property grid. I am using custom property grid as I do not want the error messages that the propertygrid shows when abphabets are entered in interger fields. The custom property grid doesn't show colloections i.e. if I have a List<Objectthen the Collection is shown but when I click on the "..." button next to it nothing comes up. If I say CustomPropertyGrid p = new CustomPropertyGrid(); p.SelectedObject = new...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.