IsPostBack
チェックはあなたが望むものであなたを助けません。あなたはデータベースを通してそれを維持する必要があります。
IsPostBack Gets a value that indicates whether the page is being rendered
for the first time or is being loaded in response to a postback.
それはページ投稿と関係があり、データベースやユーザーやロジックとは関係ありません:)
ロジックを支援するために、ユーザーが初めて来たかどうかを識別するための別の列を維持する必要があります。
1つの単純なロジック:
テーブルに列をLastLoginDate
作成し、null許容にします。ユーザーを登録するときは、このフィールドをNULLのままにしてください。
ユーザーがログインするときに、LastLoginDate
がNULLかどうかを確認するだけです。
if(userObj.LastLoginDate == null)
{
//user has come for the first time
//code to update the LastLoginDate to DateTime.Now
Redirect("resetPassword.aspx");
}
else
{
//code to update the LastLoginDate to DateTime.Now
Redirect("home.aspx");
}