Very simple code in Asp.net and MVC
Asp.net
public void Login(string userName,string pwd){
if(userName == "XXXX" && pwd == "XXX")
{
response.redirect("%youpage%");
}
else
{
response.redirect("%login.aspx%");
}
}
if you use MVC
public ActionResult loginAction(string userName,string pwd)
{
}
and you can configure in your web.xml or Global.ascx