We need an example of a WCF service that returns the message "user not found" if the user has not been authenticated. User data is written to the xml file.

Closed due to the fact that the essence of the question is not clear by the participants aleksandr barakin , cheops , dirkgntly , Streletz , Bald Aug 8 '16 at 4:22 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • What part of the assignment do you have questions? You do not understand how to build WCF-services? Or you do not know how to compare the received login-password with the data in the XML-file? - AK
  • There is an xml file with user data. There is a wcf service and a console client. It is necessary that when you enter a login-password that is not in the database, the message "incorrect password / login" is displayed. - Svitlana Golokoz
  • one
    Show the contracts that have already been made + give the structure of the xml-file. - AK

1 answer 1

First, create a WCF service: How to create a simple WCF HTTP web service

Service Interface:

[ServiceContract] public interface IService { [OperationContract] [WebGet] string HasAccess(string s); } 

Service:

 public class Service : IService { public string HasAccess(string s) { return "Hello " + s; } } 

Then, inside the service method, read the data from the XML: Walkthrough. Reading XML data into a dataset or something like this: A practical guide. Reading object data from an XML file (C # and Visual Basic)

One way to read the data. You just need to read a little and deal with it. And then inside the method we read the data from xml, we do the necessary verification and it’s ready - return what you need.

  • Denis, ATP for accessibility)) is able to pile a service, but I can’t connect the client authentication by login password with the data in the xml file. - Svitlana Golokoz