Once the user click on OK button, then validate user entered value.
Then insert the user entry in database.
if the user entry is successfully inserted,
then
redirect user to Home page,
else
redirect to Register page
Code may be like below...
int rowaffected = "INSERT INTO Users Values ('UserName', 'Password')";
if(rowaffected >= 1)
{
Responce.Redirect("Home.aspx");
}
else
{
Responce.Redirect("Register.aspx");
}