Membership Database - Account Expiration

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.
 
G

Guest

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();
}
 
G

Guest

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();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top