Note that there are some explanatory texts on larger screens.

plurals
  1. POcould not find new column in aspnet_Membership table
    text
    copied!<p>I had added in a new column called "ForgotPasswordDate" into aspnet_Membership table. When a user hit the submit button in the Password Recovery Control, it would store the timing that user hit the button into the "ForgotPasswordDate" column by using the getDate() method. </p> <p>After which, user would receive an email which contain an URL directing them into ChangePassword.apsx. </p> <p>I wanted to make the ChangePassword.aspx page expired after 1 day the user had requested for new password. This would be done by using the time in "ForgotPasswordDate" column and using the AddDay() method. </p> <p>However, the code gave me a problem. Which I think they could not recognize the "ForgotPasswordDate" column inside the Membership table. </p> <p>This is the code which had an error: </p> <pre><code>if (DateTime.Now &lt; user.ForgotPasswordDate.AddMinutes(3)) </code></pre> <p>for testing purposes, currently I just set the logic as 3 minutes. </p> <p>And the error message is: </p> <pre><code>System.Web.Security.MembershipUser' does not contain a definition for 'ForgotPasswordDate' and no extension method 'ForgotPasswordDate' accepting a first argument of type 'System.Web.Security.MembershipUser' could be found (are you missing a using directive or an assembly reference? </code></pre> <p>Here is the whole code: </p> <pre><code> protected void Page_Load(object sender, EventArgs e) { //if the id is in the query string if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { //store the user id Guid userId = new Guid(Request.QueryString["ID"]); //attempt to get the user's information MembershipUser user = Membership.GetUser(userId); if (DateTime.Now &lt; user.ForgotPasswordDate.AddMinutes(3)) //here is the part { //Page not expire yet. hidden.Text = user.ProviderUserKey.ToString(); Server.Transfer("~/ChangePassword.aspx"); } else { //Expired; direct to Page Expired Page Server.Transfer("~/PageExpired.aspx"); } } } </code></pre> <p>is there anyway that the system could recognize the new column in aspnet_membership table? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload