how to check whether password is case sensitive or not in c#

Posted by Deepakji under C# on 3/19/2012 | Points: 10 | Views : 4849 | Status : [Member] | Replies : 5
hi i have create login page but i want o restrict it based on case sensitive so please let me know how to do that.




Responses

Posted by: Patel28rajendra on: 3/19/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

visit this link

http://stackoverflow.com/questions/444798/case-insensitive-containsstring

R D Patel

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

Posted by: Sksamantaray on: 3/19/2012 [Member] Silver | Points: 25

Up
0
Down
Hi ,
You can use Regular Expression.
Suppose you want the password has to be only in Capital letter:

<form id="form1" runat="server">

<div>

<asp:TextBox id="txtInput" runat="server"></asp:TextBox><br />
<asp:RegularExpressionValidator Id="vldRejex" RunAt="server" ControlToValidate="txtInput" ErrorMessage="Only Capital alphabets are allowed"
ValidationExpression="^[A-Z]+$">
</asp:RegularExpressionValidator><br />
<asp:Button Id="btnSubmit" RunAt="server" CausesValidation="True" Text="Submit"></asp:Button>
</div>
</form>


Thanks,
Sanjay

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

Posted by: Sksamantaray on: 3/19/2012 [Member] Silver | Points: 25

Up
0
Down
Hi,
Using Javascript:
http://www.dotnetspider.com/resources/41669-Validation-for-alphabets-only-using-regular.aspx

Thanks,
Sanjay

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

Posted by: Rajni.Shekhar on: 3/20/2012 [Member] Bronze | Points: 25

Up
0
Down
You can check by using compare method of a string

1) Get pwd from database of inputed login ID.
2) compare inputed password with db password

string.Compare(txtPwd.Text.Trim().ToString(),strPwd,False); //strPwd is string and having password from database.

OR

You can check it at database level also, create a procedure which will return true or false if pwd is correct/not-correct (use case sensitivity at DB level).

OR

you can use algo for encryption/decryption (SHA1)

Thanks,
Rajni Shekhar

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

Posted by: Sabarimahesh on: 3/20/2012 [Member] Bronze | Points: 25

Up
0
Down
Using System.Globalisation;


if (System.String.Compare ("DOTNETFUNDA", "dotnetfunda", true) == 0)

{
CultureInfo.CurrentCulture.CompareInfo.Compare
(
"DOTNETFUNDA", "dotnetfunda",
CompareOptions.IgnoreCase |
CompareOptions.IgnoreKanaType |
CompareOptions.IgnoreWidth
);

}


Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

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

Login to post response