user1509
user1509

Reputation: 1161

Call webservice in windows application

I have a windows application and I require that the user logins in the application by the username and password which were provided to the user in the website. For this purpose, firstly I check whether the user is connected to internet or not. If there is a connection, then proceeds to check whether the credentials are valid or not. So, I need to call a webservice in the windows application. How do I proceed in this?

Any examples explaining the procedure to call webservice in windows application are welcome.

Upvotes: 4

Views: 9665

Answers (1)

Niranjan Singh
Niranjan Singh

Reputation: 18290

Check this answer on SO Thread and Code project article - Webservice with Win Forms and Web Forms to move further.

To consume web service in visual studio, check the steps below...

Follow these steps

  1. Right click on the Project in Visual Studio
  2. Select Add Web Reference
  3. Enter URL & proceed

When you don't see that option

  1. Right click on the Project in Visual Studio
  2. Select Add Service Reference
  3. Press "Advanced" Button
  4. Press "Add Web Reference" Button
  5. Enter URL & proceed

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

Edit: System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() should get you what you want to check the internet etc..

Refer :
How do you determine if an Internet connection is available for your WinForms App?
and
What's the best way to detect an internet connection using .NET?

Upvotes: 7

Related Questions