Skip to content

How to set expired password date in databse in mvc

jothi kumar

Asked Aug 8, 2014, 9:01 PM EDT1 answer
Share
LinkedInX
hi to all,
              Here i using this code to compare current date and expired password date
VB.NET
                                  if (DateTime.Now > userObject.PasswordExpiredDate)
                                              return RedirectToAction("PasswordChange", "Index");

                       i want to change 30 days once to change the password. now i want to save expired password date in database how to i save it kindly help me
FOR EXAMPLE:
Let consider here i create user 1.6.2014 but i want to save in database 1.7.2014 then only i  should compare current date and expired date can you tell how to do?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    I say you can design this way. 

    Have field say password created date , e.g., PwdCreatedDate and second column as validity 30days, now your code should look like this,

    If (datetime.now > DateTime.Add(userObject.PwdCreatedDate,30))
    return .....

    Please accept answer if you find it helpful! 
    0