Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to display a Password Expiry Message in Asp.net ?
=====================================================

Am working on Asp.net , C#, SqlServer2005.

in my Application am using Issue Date and Expiry Date....its working fine.

So, After User Login into application ...I need to display a message using Label.

"your password will be Expire on 04/july/2013....and left over days is 364"

This Message should show for every user DAILY after login into application.


Please suggest me how to do this.

Thanks in Advance.
Posted
Comments
AmitGajjar 4-Jul-12 6:40am    
See my solution 2. if you still have any query either improve your question or add comment.

Hey Ubaid,

What have you tried, or where do you get stuck? Is seems to be a straight forward solution, so I'm curious how what you've done so far?

You should query the database for the expiration date. You can calculate the total amount of days using a timespan :

Timespan ts = DateTime.Now - expirationDate;
Console.WriteLine("Password expires in " + ts.TotalDays + " days");


If you still run into problems, please describe in more detail where you get stuck. This helps us to point to in the right direction.

Hope it helps,
Eduard
 
Share this answer
 
Comments
Ubaid ur Rahman IT 4-Jul-12 4:54am    
Hello Sir, Where should we write this code. Just I need to display this Message in Welcome Page after User Logged in.

that, " your password will expire on 04/july/2012 and left days are 364.

Please tell me boss, its Urgent.

Thanks.
Ubaid ur Rahman IT 4-Jul-12 4:55am    
Sorry

Replace with 2013
AmitGajjar 4-Jul-12 6:40am    
correct, just one correction. question is tag in asp.net so console.writeline will not work :) 5+
Suman Zalodiya 4-Jul-12 15:38pm    
You can try

label.Text= "Password expires in " + ts.TotalDays + " days";

I think it will work
[no name] 5-Jul-12 2:50am    
My 5+
Hi,

hope you do not have any problem with calculating expire date. what i understand from your question is, you need help in UI.

you can use jQueryUI Dialog box to show popup after login.

and if you have problem with calculating expire date then follow instruction given by Eduard(Solution 1).

Thanks
-Amit.
 
Share this answer
 
Comments
Ubaid ur Rahman IT 4-Jul-12 6:59am    
Please I need In Asp.net Web application. I need to calculate with Expiry date.

Already I have Created User...In that i have fields Issue date and Expiry Date.

Just I need to display a message with label

" your password will Expire on this particular date" and leftover days are 22 like this.

Please help me.
Thanks.
AmitGajjar 4-Jul-12 7:13am    
please post what you have done. and also give me some answer: 1) do you know how to get data from database ? 2) do you know how to create string ? 3) do you know how to show string in popup message ?
Ubaid ur Rahman IT 5-Jul-12 3:27am    
Boss, I have did everything, Just I need a Message Daily for Password Expire.

I database I have Field as Expiry Date.

Please tell me boss, waiting for your answer.
AmitGajjar 5-Jul-12 3:40am    
have you tried with jQuery Dialog box to show message when user login ?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900