Nothing returned after authentication?


When I try to return the student using this method it doesnt show anything or any error, if I however dont put anything in the password box I get a 404 error so I know its working so my authenticate method isnt working, I basically want to authenticate the user and return something from the student collection, like the FirstName?

    private void button20_Click(object sender, EventArgs e)
        string uri = string.Format("http://localhost:8000/Service/AuthenticateStudent/{0}/{1}", textBox28.Text, textBox29.Text);
        XDocument xDoc = XDocument.Load(uri);
        var Tag12 = xDoc.Descendants("Student")
            .Select(n => new
                FirstName = n.Element("FirstName").Value,

        dataGridView12.DataSource = Tag12;


You'll want to create a special return type that includes the boolean you're currently returning, as well as the Student:

public class AuthenticationResult
    public bool IsValid {get;set;}
    public Student ValidatedStudent {get;set;}

Then return an object of this type from your WCF method:

public AuthenticationResult AuthenticateStudent(string studentID, string password)
    var result = students.FirstOrDefault(n =

This video can help you solving your question :)
By: admin