Samiksha
Samiksha

Reputation: 6182

How to pass parameters to a Web Method?

How to pass parameters to [WebMethod] in Asp.Net(C#) ? Can some one please explain the same with the help of an example?

Upvotes: 2

Views: 4995

Answers (3)

John Saunders
John Saunders

Reputation: 161773

See How to Consume a Web Service. Even though it's from the point of view of a WCF service and Service Reference, it largely applies to legacy ASMX web references.

Upvotes: 1

Sergio
Sergio

Reputation: 8259

You can see an example here: http://support.microsoft.com/kb/818364

If the helloWorld example received a string you would invoke it like so: myService.HelloWorld("Example");

Upvotes: 2

Sergio
Sergio

Reputation: 8259

After you add the web reference you must create an instance of the class that contains the webmethod, then you pass parameters the exact same way as any other method.

Upvotes: 3

Related Questions