leeny
01-27-2005, 02:20 AM
how can i make my user authentication in ASP case sensitive?any1?
|
Click to See Complete Forum and Search --> : user authentication leeny 01-27-2005, 02:20 AM how can i make my user authentication in ASP case sensitive?any1? leeny 01-27-2005, 03:13 AM myabe i shuld elaborate further. Currently, i allow user to enter their username and of cos store it in the database. Following which, when the user logs in, the username he types must match with the one in the DB(of cos) in respect to their case. For example username is mIcKy therefore whatever the user types must be in respect to it. is there any way? or it's in poss? lmf232s 01-27-2005, 09:50 AM well i think when you compare strings its already case sensitive. So if the user types in mikey and the database value is mIkey then this expression if mikey = mIkey then will be false because of the case difference. NinjaCodeMonkey 01-27-2005, 10:11 AM VBScript doesn't support comparing case-sensitive strings. Though, JavaScript does. Here is an example of how to call the javascript function from vbscript. <% boolVal = compareString("Test", "TEST) %> <script language="JScript" runat="server"> function compareString(string1, string2) { if(string1 == string2) { return true; } else { return false; } } </script> This is a pretty quick and easy way to do it. Let me know if this helps. lmf232s 01-27-2005, 10:16 AM if Test = "TEST" then Response.Write "true" else Response.Write "false" end if this will return false if Test = "Test" then Response.Write "true" else Response.Write "false" end if this will return true NinjaCodeMonkey 01-27-2005, 10:19 AM Alas, I was mistaken. You can use the StrComp() function in VBScript. Here is the link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctstrcomp.asp EXAMPLE: Dim MyStr1, MyStr2, MyComp MyStr1 = "ABCD": MyStr2 = "abcd" ' Define variables. MyComp = StrComp(MyStr1, MyStr2, 1) ' Returns 0. TextCompare MyComp = StrComp(MyStr1, MyStr2, 0) ' Returns -1. BinaryCompare MyComp = StrComp(MyStr2, MyStr1) ' Returns 1. Also, BinaryCompare You would want to use "0" for the third argument. It does a binary comparison of the strings, which in your case may or may not be different. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |