如何向 Web 方法传递参数?

发布于 2024-07-10 05:46:30 字数 58 浏览 6 评论 0原文

如何在Asp.Net(C#)中向[WebMethod]传递参数? 有人可以通过一个例子来解释一下吗?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

战皆罪 2024-07-17 05:46:30

添加 Web 引用后,您必须创建包含 webmethod 的类的实例,然后以与任何其他方法完全相同的方式传递参数。

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.

新雨望断虹 2024-07-17 05:46:30

您可以在此处查看示例:
http://support.microsoft.com/kb/818364

如果 helloWorld 示例收到一个字符串你可以像这样调用它:
myService.HelloWorld("示例");

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");

眼眸里的快感 2024-07-17 05:46:30

请参阅如何使用 Web 服务。 尽管它是从 WCF 服务和服务引用的角度来看的,但它主要适用于旧版 ASMX Web 引用。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文