469,923 Members | 1,543 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

Membership Database - Account Expiration

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.
Oct 5 '06 #1
3 2325
Check this link -
http://www.devx.com/asp/Article/29256/0/page/2
--
Ameet Phadnis
Sr. Technical Consultant
e Tek Global Inc.
ASP Alliance Author Page: http://aspalliance.com/author.aspx?uId=44260
"netsecsvc" wrote:
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.
Oct 5 '06 #2
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.RESUL TS!!!);
DateTime now = DateTime.Now;
if (now createdate.AddDays(30))
{
Label1.Visible = true;
Session.Abandon();
}
Oct 5 '06 #3
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();

--
brians
http://www.limbertech.com
"netsecsvc" wrote:
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.
Oct 5 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Vishal Gupta | last post: by
2 posts views Thread by Michael | last post: by
3 posts views Thread by Carlos | last post: by
4 posts views Thread by =?Utf-8?B?Q2hyaXMgQ2Fw?= | last post: by
4 posts views Thread by =?Utf-8?B?U2FsYW1FbGlhcw==?= | last post: by
3 posts views Thread by GaryDean | last post: by
1 post views Thread by Paul | last post: by
2 posts views Thread by Bobby Edward | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.