Home All Groups Group Topic Archive Search About

Aplying more than 1 attributes ?????

Author
22 Aug 2006 8:24 AM
serge calderara
Dear all,

I am using framework 1.1
I try to add 2 security atributes to a component class but not able to do it
based on syntax mistake that I could not find out. Applying one atribute is
ok but more is a trouble...

here si the code :
====================

Imports System.EnterpriseServices

Public Interface IServComp
    Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
End Interface

<ComponentAccessControl()  _
<SecureMethod()> _
Public Class SimpleComponent
Inherits System.EnterpriseServices.ServicedComponent
Implements IServComp

Public Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
Implements IServComp.add
    Return (N1 + N2)
End Function
End Class

errors that I get here are has follow :
'>' expected
'End class must preceed by matching class
Statment is not valid in a namespace

If I remove the second attribute, its ok.....

What is the syntax to add more than one attributes ???

thnaks for help
serge

Author
22 Aug 2006 9:18 AM
oldbear
Hi

You were nearly there!

Just change:

<ComponentAccessControl()  _
<SecureMethod()> _
Public Class SimpleComponent


to:

<ComponentAccessControl()>  _
<SecureMethod()> _
Public Class SimpleComponent


It's the missing > at the end of the ComponentAccessControl attribute.

Hope this helps

--
----------------------------------
Chris Seary
http://blog.searyblog.com/




Show quoteHide quote
"serge calderara" wrote:

> Dear all,
>
> I am using framework 1.1
> I try to add 2 security atributes to a component class but not able to do it
> based on syntax mistake that I could not find out. Applying one atribute is
> ok but more is a trouble...
>
> here si the code :
> ====================
>
> Imports System.EnterpriseServices
>
> Public Interface IServComp
>     Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
> End Interface
>
> <ComponentAccessControl()  _
> <SecureMethod()> _
> Public Class SimpleComponent
> Inherits System.EnterpriseServices.ServicedComponent
> Implements IServComp
>
> Public Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
> Implements IServComp.add
>     Return (N1 + N2)
> End Function
> End Class
>
> errors that I get here are has follow :
> '>' expected
> 'End class must preceed by matching class
> Statment is not valid in a namespace
>
> If I remove the second attribute, its ok.....
>
> What is the syntax to add more than one attributes ???
>
> thnaks for help
> serge
Author
22 Aug 2006 11:29 AM
serge calderara
Sorry that was a mistake when I post this message. The '>'  was present at
then end. SO then I get erorr as follow still:

'End class' must preceed by matching class
Statment is not valid in a namespace
Attribute specified is not a complete statement. use a line continuation to
apply the atribute

any idea ?
Once again no error if I leave only one single attribute

trhnaks

Show quoteHide quote
"oldbear" wrote:

> Hi
>
> You were nearly there!
>
> Just change:
>
> <ComponentAccessControl()  _
> <SecureMethod()> _
> Public Class SimpleComponent
>
>
> to:
>
> <ComponentAccessControl()>  _
> <SecureMethod()> _
> Public Class SimpleComponent
>
>
> It's the missing > at the end of the ComponentAccessControl attribute.
>
> Hope this helps
>
> --
> ----------------------------------
> Chris Seary
> http://blog.searyblog.com/
>
>
>
>
> "serge calderara" wrote:
>
> > Dear all,
> >
> > I am using framework 1.1
> > I try to add 2 security atributes to a component class but not able to do it
> > based on syntax mistake that I could not find out. Applying one atribute is
> > ok but more is a trouble...
> >
> > here si the code :
> > ====================
> >
> > Imports System.EnterpriseServices
> >
> > Public Interface IServComp
> >     Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
> > End Interface
> >
> > <ComponentAccessControl()  _
> > <SecureMethod()> _
> > Public Class SimpleComponent
> > Inherits System.EnterpriseServices.ServicedComponent
> > Implements IServComp
> >
> > Public Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
> > Implements IServComp.add
> >     Return (N1 + N2)
> > End Function
> > End Class
> >
> > errors that I get here are has follow :
> > '>' expected
> > 'End class must preceed by matching class
> > Statment is not valid in a namespace
> >
> > If I remove the second attribute, its ok.....
> >
> > What is the syntax to add more than one attributes ???
> >
> > thnaks for help
> > serge
Author
22 Aug 2006 3:41 PM
Marina Levit [MVP]
Try

<ComponentAccessControl(),  _
SecureMethod()> _
Public Class SimpleComponent

Show quoteHide quote
"serge calderara" <sergecalder***@discussions.microsoft.com> wrote in
message news:79C7F7C7-C73E-45A9-8017-5C5A1761A4C6@microsoft.com...
> Dear all,
>
> I am using framework 1.1
> I try to add 2 security atributes to a component class but not able to do
> it
> based on syntax mistake that I could not find out. Applying one atribute
> is
> ok but more is a trouble...
>
> here si the code :
> ====================
>
> Imports System.EnterpriseServices
>
> Public Interface IServComp
>    Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
> End Interface
>
> <ComponentAccessControl()  _
> <SecureMethod()> _
> Public Class SimpleComponent
> Inherits System.EnterpriseServices.ServicedComponent
> Implements IServComp
>
> Public Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
> Implements IServComp.add
>    Return (N1 + N2)
> End Function
> End Class
>
> errors that I get here are has follow :
> '>' expected
> 'End class must preceed by matching class
> Statment is not valid in a namespace
>
> If I remove the second attribute, its ok.....
>
> What is the syntax to add more than one attributes ???
>
> thnaks for help
> serge
Author
23 Aug 2006 7:18 AM
serge calderara
Thanks marina, that was the proper syntax
Serge

Show quoteHide quote
"Marina Levit [MVP]" wrote:

> Try
>
> <ComponentAccessControl(),  _
> SecureMethod()> _
> Public Class SimpleComponent
>
> "serge calderara" <sergecalder***@discussions.microsoft.com> wrote in
> message news:79C7F7C7-C73E-45A9-8017-5C5A1761A4C6@microsoft.com...
> > Dear all,
> >
> > I am using framework 1.1
> > I try to add 2 security atributes to a component class but not able to do
> > it
> > based on syntax mistake that I could not find out. Applying one atribute
> > is
> > ok but more is a trouble...
> >
> > here si the code :
> > ====================
> >
> > Imports System.EnterpriseServices
> >
> > Public Interface IServComp
> >    Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
> > End Interface
> >
> > <ComponentAccessControl()  _
> > <SecureMethod()> _
> > Public Class SimpleComponent
> > Inherits System.EnterpriseServices.ServicedComponent
> > Implements IServComp
> >
> > Public Function add(ByVal N1 As Integer, ByVal N2 As Integer) As Integer
> > Implements IServComp.add
> >    Return (N1 + N2)
> > End Function
> > End Class
> >
> > errors that I get here are has follow :
> > '>' expected
> > 'End class must preceed by matching class
> > Statment is not valid in a namespace
> >
> > If I remove the second attribute, its ok.....
> >
> > What is the syntax to add more than one attributes ???
> >
> > thnaks for help
> > serge
>
>
>