【问题标题】:Call webservice in windows application在 windows 应用程序中调用 web 服务
【发布时间】:2012-09-11 06:19:54
【问题描述】:

我有一个 Windows 应用程序,我要求用户使用网站中提供给用户的用户名和密码登录应用程序。为此,首先我检查用户是否连接到互联网。如果存在连接,则继续检查凭据是否有效。所以,我需要在 windows 应用程序中调用一个 web 服务。我该怎么做?

欢迎提供任何解释在 windows 应用程序中调用 web 服务的过程的示例。

【问题讨论】:

  • 凭证是如何存储的?您使用的是会员服务提供商吗?
  • 是的。我在我的应用程序中使用 Membership Provider。

标签: winforms web-services c#-4.0


【解决方案1】:

在 SO 线程和代码项目文章中查看此 answer - Webservice with Win Forms and Web Forms 以进一步了解。

要在 Visual Studio 中使用 Web 服务,请检查以下步骤...

按照这些步骤操作

  1. 在 Visual Studio 中右键单击项目
  2. 选择添加网络参考
  3. 输入网址并继续

当您没有看到该选项时

  1. 在 Visual Studio 中右键单击项目
  2. 选择添加服务参考
  3. 按“高级”按钮
  4. 按“添加 Web 参考”按钮
  5. 输入网址并继续

参考:
Creating an ASP.NET web services and consuming it with a Win Form

编辑: System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() 应该可以为您提供您想要查看互联网等的内容。

请参考:
How do you determine if an Internet connection is available for your WinForms App?

What's the best way to detect an internet connection using .NET?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多