I have created this web service

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }


    [WebMethod]
    public string user(string strusername, string strpassword)
    {
        string user = "";

        Console.WriteLine("Geusts leave boxes blank");

        if ((strusername == "paul") && (strpassword == "paul"))
        {
            user = "Overall Co-Ordinator";
        }

        if ((strusername == "lisa") && (strpassword == "lisa"))
        {
            user = "Overall Food Coordinator";
        }

        if ((strusername == "rob") && (strpassword == "rob"))
        {
            user = "Overall Programme Coordinator";
        }
        
        if ((strusername == "") && (strpassword == ""))
        {
            user = "Guest";
        }
        
        return user;
    }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }
    
}

I need to use it on a login page on a web-page.

Then each user has a different page they are taken too.

i.e. Overall Co-Ordinator see's the whole of my created database on his/her own page. and food co ordinator can only veiw the food part of my database etc.

Edited 7 Years Ago by foxypj: Changed question

You can only return a single object from the method, but that object can contain multiple values depending on its type; you can use a collection to return multiple values of the same type, or the following uses a struct to return a bool and a string:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            Login CurrentLogin = processLogin();
        }

        private Login processLogin()
        {
            Login newLogin = new Login();
            newLogin.valid = false;

            if ((strusername == "paul") && (strpassword == "paul"))
            {
                newLogin.valid = true;
                newLogin.LoginName = "overall co-ordinator";
            }

            return newLogin;
        }

    }

    public struct Login
    {
       public bool valid;
       public string LoginName;
    }

Edited 7 Years Ago by Geekitygeek: n/a

This article has been dead for over six months. Start a new discussion instead.