Attributes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zviki Goldberg

    #1

    Attributes

    Hi All...

    I have a Auditing system. I want to send Audit messages using attributes. I
    managed to activate the ContextAttribut e object, BUT it forced me to inherit
    from ContextBound object (which is too much for me, cause I want to use this
    attribute auditing also in web pages).
    Is there any option to do so ?
    Maybe the solution is somewhere in the Demand staff (.NET rle base
    security).... How is that check enabled ??

    Thanks a lot,...

    Zviki.


  • Keith Patrick

    #2
    Re: Attributes

    You can apply attributes to any construct specified in AttributeTarget s.
    The thing is, they don't automatically execute, as they are merely
    attributes. Certain attributes appear to do so (like
    SoapExtenstionA ttribute and ContextAttribut e) because a superclass has a
    method call that introspects the construct to search for appropriate
    attributes of a certain type and acts upon them. So, to make a long story
    short, the only way you can have certain web pages execute an attribute is
    to insert it into an already-existing attribute-checking infrastructure
    (again, SoapExtensionAt tribute is a fine example, as the web service
    superclass automatically looks for SoapExtentionAt tributes)
    Another avenue is to put some code to look for and deal with attributes in
    some central method call (an MSDN search for SqlParameterAtt ribute will
    produce an article illustrating this)

    "Zviki Goldberg" <zvikig@matrix. co.il> wrote in message
    news:%234JTjTcW DHA.2360@TK2MSF TNGP12.phx.gbl. ..[color=blue]
    > Hi All...
    >
    > I have a Auditing system. I want to send Audit messages using attributes.[/color]
    I[color=blue]
    > managed to activate the ContextAttribut e object, BUT it forced me to[/color]
    inherit[color=blue]
    > from ContextBound object (which is too much for me, cause I want to use[/color]
    this[color=blue]
    > attribute auditing also in web pages).
    > Is there any option to do so ?
    > Maybe the solution is somewhere in the Demand staff (.NET rle base
    > security).... How is that check enabled ??
    >
    > Thanks a lot,...
    >
    > Zviki.
    >
    >[/color]


    Comment

    • Richard Grimes [MVP]

      #3
      Re: Attributes


      "Zviki Goldberg" <zvikig@matrix. co.il> wrote in message
      news:%234JTjTcW DHA.2360@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      > Hi All...
      >
      > I have a Auditing system. I want to send Audit messages using attributes.[/color]
      I[color=blue]
      > managed to activate the ContextAttribut e object, BUT it forced me to[/color]
      inherit[color=blue]
      > from ContextBound object (which is too much for me, cause I want to use[/color]
      this[color=blue]
      > attribute auditing also in web pages).[/color]

      Why is this a problem? In an auditing system you want to get informed when
      an object method is called. By creating a new context you are defining a
      context boundary that must be crossed when method calls are made, hence you
      can intercept those calls and do your auditing. The is procisely what
      contexts are for (allowing you to intercept method calls).

      Have a look at this magazine article for more details (or even buy Juval
      Lowy's recent book on .NET Components):

      http://msdn.microsoft.com/msdnmag/is...ContextsinNET/

      Richard
      --
      my email evpuneqt@zicf.b et is encrypted with ROT13 (www.rot13.org)


      Comment

      Working...