How do I get the WebMethodAttribute from within a webmethod?

D

Doug

I need the description out of the WebMethodAttribute on my web method. I
want to be able to throw my own exception and tell it what method threw the
exception...I am totally at a loss for how to "create" a webmethodattribute
class?

Here is my code...

<WebMethod(Description:="my bad webmethod")> _
Public Function MyBadWebmethod() as string
try
throw new MyAppException("something went wrong")
catch ex as MyAppException
dim wma as WebMethodAttribute

' How do I get a reference to this methods WebMethodAttribute
class?
dim sdesc as string

dim soapex as new soapexception(......
End Function

thanks
Doug
 
T

Tomas Restrepo \(MVP\)

Doug,
I need the description out of the WebMethodAttribute on my web method. I
want to be able to throw my own exception and tell it what method threw the
exception...I am totally at a loss for how to "create" a webmethodattribute
class?

Use reflection. Just use the GetCustomAttributes() method of the MethodInfo
class for this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top