Hello Vishal,
You can achieve by doing in the following way.
First declare the key name and its values with comma separated as below
<configuration>
<appSettings>
<add key="user1" value="user1,user2,user3,user4,user5"/>
<add key="pwd1" value="pwd1,pwd2,pwd3,pwd4,pwd5"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
Now you can validate with user name and password as below on button click
protected void btnLogin_Click(object sender, EventArgs e)
{
string userName = ConfigurationManager.AppSettings["user1"];
string password = ConfigurationManager.AppSettings["pwd1"];
string[] users = userName.Split(',');
string[] pwds = password.Split(',');
foreach (string user in users)
{
if (TextBox1.Text == user) //User Exists
{
foreach (string pwd in pwds)
{
if (TextBox2.Text == pwd) //Password Exists
{
//Now you have already checked the username and passwor is correct
if (Array.IndexOf(users,user) == Array.IndexOf(pwds,pwd)) // This line check user and password for same index.
{
//You can write your logic here
Response.Write("Login Successfull...");
return;
}
else
{
Response.Write("Login Failed...");
return;
}
}
}
}
}
}
Alternatively I find the attached code and let me know...
Thanks