If you save your credentials in a session, I hope you encrypt them.
But yes, if you already have your credentials, you can do:
FormsAuthentication.SetAuthCookie(username, true);
You can also run:
if(Membership.ValidateUser(username, password)) { FormsAuthentication.SetAuthCookie(username, true); }
to make sure you have the correct username and password.
source share