Hi,
As we know content page merge with master page,so if you will write code for valid user on master page then it will applies to all the inherited content page
please refer below article
Validating (Check) Username and Password from database in ASP.Net
and you can simply replace login control with username and password textboxes.