Membership Database - Account Expiration

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a customer who would like to set an expiration date on user accounts
to 30 days. I'm using Asp.net 2.0 (VS 2005) with the default membership
database and forms authentication.

How do I query the membership database? I see a createdate field that I
believe is what I want, but I'm just not familiar with customizing the user
accounts in the membership database.
 
Let me be more clear. I am familiar with VS2003 and the dataadapter,
sqlconnection and dataset, etc. But in VS2005 those seem to be replaced with
the SQLDATASOURCE. I went ahead and configured a SQLDATASOURCE so it should
provide the results I want from the membership database -- that seems really
straightforward. But now how do I get the results from that sqldatasource?
I know how to databind with it, but I don't want to databind, I just want its
results. Here is what I'm thinking...obviously there is no "RESULTS"
method...

DateTime createdate=Convert.ToDateTime(SqlDataSource1.RESULTS!!!);
DateTime now = DateTime.Now;
if (now > createdate.AddDays(30))
{
Label1.Visible = true;
Session.Abandon();
}
 
Hello netsecsvc,

All the user attributes are available via the MembershipUser object. You can
find the CreationDate (also, the LastActivityDate, which might be more
interesting to you) for the user by:

MembershipUser user = Membership.GetUser();
lblCreationDate.Text = user.CreationDate.ToString();
lblLastActiveDate.Text = user.LastActivityDate.ToString();
 
Back
Top