code for password validation

Posted by Rrana under ASP.NET on 9/13/2011 | Points: 10 | Views : 4804 | Status : [Member] | Replies : 5
Hi,

password should accepts only one numeric,one special character and string length is 8.




Thanks in Advance

Sucharitha Goud
Bank Of America..



Responses

Posted by: Prabhakar on: 9/14/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Rana,


Only Number so Use Regular Expression validator
and read this Tutorial page...
http://www.dotnetfunda.com/tutorials/controls/regularexpressionvalidator.aspx

Best Regard's
Prabhakar

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 9/14/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
rana


and that accept only 8 alphanumeric characters so try this Regular Expression validation . .

<asp:RegularExpressionValidator id="rev1" runat="server" SetFocusOnError="True"
ErrorMessage="TextBox must be 30 characters long" Display="Dynamic"
ControlToValidate="TextBox1" ValidationExpression="^[a-zA-Z0-9]{8}$">
</asp:RegularExpressionValidator>


Best Regard's
Prabhakar

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rrana on: 9/15/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Prabhakar,

Thanks for your Response


Sucharitha Goud
Bank Of America..

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 9/21/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi

Try this regexp [d]?^[^A-Za-z0-9]?^.{8}$ to validate your password.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vijay.K on: 9/12/2012 [Member] Starter | Points: 25

Up
0
Down
<asp:TextBox ID="TextBox1" runat="server" onkeypress="return (event.keyCode != 32&&event.which!=32)" ></asp:TextBox>


the above key Restict the space key in textbox


vijay.k

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response