Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL-Server
Dear Friends,
 
Am working on Asp.net , c#, SQLSERVER 2005.
 
In my project, A message must be displayed to user if his password expires.
 
I have a Registration(Add new user) webform in my project. in that i have fields
Firstname, Lastname,DisplayName,Username,Password,IssueDate,ExpiryDate.
 
While creating New User, Administrator will enter all information of user FN,LN,DN,Username,Pwd,IssueDate,ExpDate.
 
Generally the issue date will be default like this 19/07/2012(System date) and the admin need to enter only Expiry year like this 2013.
 
Suppose, if the user passed the year 2013. a message must be displayed while login
"your Password has Expired, Please contact Administrator"
 

Please help me , how to solve this.
 

Thanks in ADVANCE.
Posted 18-Jul-12 21:30pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Let's say for each user you have a expiry year defined.
 
You need to fetch the expiry year for a user and compare with today's date's year. If they match then the password has expired and you need to show the prompt.
SELECT UserID
FROM User
WHERE ExpiryYear >= DATEPART(year,GETDATE())
AND UserID = @currentLoggedInUser
If any data is returned from the query then that user password has expired.
  Permalink  
Comments
sandeep nagabhairava at 19-Jul-12 4:34am
   
good work sandeep my 5!
Sandeep Mewara at 19-Jul-12 4:38am
   
Thanks.
 
sandeep nagabhairava at 19-Jul-12 4:40am
   
hoo.. unfortunately i for got it... hold this...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you will do a query like this
 
select 1 from your table where userid= and getdate =
 
if it satisfies 1 will be returned then pass word is expired.
  Permalink  
Comments
Ranjith Reddy CSE at 19-Jul-12 4:04am
   
am not clear, what is 1. Please explain me boss.
Explain me in detail
 
Thanks
Ranjith Reddy CSE at 19-Jul-12 4:08am
   
Suppose if the Users Expiry date is less than todays date. It must display a message like this.
 
"Your Password has Expired,Please contact administrator"
 
Thanks , Please help me brothers.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

hi ranjit

You try like this i am, showing in 2tier format for just understanding purpose,
 
bring Expiry date from Database
ex:
 
Select Max(ExpiryDate) from TABLE where Username='"+txtusername+"' and Password='"+txtpassword+"'
 
cn.Open();
Datetime ExpDate;
              dr = cmd.ExecuteReader();
 
              if (dr.Read() == true)
              {
 
                ExpDate=convert.todatetime( dr[0].ToString());
              }
              cn.Close();
if(ExpDate<datetime.now.year)>
{
//Show your msg hear
}
else
{
//write yor code hear
}
 
i hope this will helps you
 
Thanks&&Regards
Sandeep
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 19 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100