1
Answer

Setting A Password Policy for a web site in c# 2008

Janavi Bhatt

Janavi Bhatt

12y
941
1

Hi All,

I have a website in c# 2008.

I m assigned a task to set the password policy for this web site.

The password Policy goes as under:
   
1.  1st char is in UpperCase
2.  2nd char is in LowerCase
3.  3rd char is a special char
4.  4th to 8th char are random digits
5.  the password expires after 6 months
6. The password can be only 8 chars.    

This is really URGENT...I m not able to figure this out. Please advise...
Your advise and support are most appreciated.

Thanks & Regards,
Answers (1)
0
Santhosh Kumar Jayaraman

Santhosh Kumar Jayaraman

NA 9.9k 2.3m 12y
Try this.
^([A-Z])([a-z])([+!_%&])([0-9]{5})

([A-Z])- will allow only if first letter is caps
([a-z])-secondletter shud be lowercase
([+!_%&])-third character shud be symbol.I have added only few.
([0-9]{5})-then it should be followed by 5 digits

Regarding password should expire in 6 months, you have to set that in Database. in User table have password changed date, where you insert current date and whenever user logisns, validate it crossed 6 months or not



sample code:

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
        ErrorMessage="RegularExpressionValidator"  ValidationExpression="^([A-Z])([a-z])([+!_%&])([0-9]{5})" ControlToValidate="TextBox1"/>