FAQ for the Login & Password Sample | CodeGuru

FAQ for the Login & Password Sample

By John Peterson Both the username and password are case-sensitive. How can I change it so they are not? Let me start by saying that I recommend that you use case-sensitive usernames and passwords. Case-sensitivity adds an additional level of complexity and can make it harder for unauthorized users to guess a user’s credentials. That […]

Written By
CodeGuru Staff
CodeGuru Staff
Jan 1, 2008
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

By John Peterson

Both the username and password are case-sensitive. How can I change it so they are not?

Let me start by saying that I recommend that you use case-sensitive usernames and passwords.
Case-sensitivity adds an additional level of complexity and can make it harder for unauthorized
users to guess a user’s credentials. That being said, if you must make your usernames and/or
passwords case-insensitive, it’s actually quite easy to do.

All you need to do is convert both the entered value and the stored value to the same case before
you compare them. I usually use LCase to make them both lower case, but using UCase to make
them upper case works exactly the same way.

As an example, here’s the original line from the classic ASP version of the sample.


If Request.Form("login") = "Guest" AND Request.Form("password") = "Guest" Then

By simply adding a few calls to LCase, the code below totally ignores the cases of the characters entered.


If LCase(Request.Form("login")) = LCase("Guest") AND LCase(Request.Form("password")) = LCase("Guest") Then

If you’re going to do this, I recommend you only switch to the case-insensitive values in the
comparison code and not in the code that retrieves or stores the values. Storing the username
and password exactly as the user entered them allows you to easily move to a case-sensitive routine
at some future date should the need arise.

How do I protect a large number of files?

If you’re trying to protect multiple files based on the same criteria, the best way to do it is to create one protection script and include it in all the files by using a server side include. If you include it into each file you want to protect, then any changes you make to it will automatically go into effect for all the files. It makes managing things much easier.

How do I secure files that are not .asp?

This sample was designed to work with .asp files. If you need to secure other types of files you should look into using NT permissions or a third party component.

Was your question not answered above?

Please note: This form is only for submitting questions about the sample for us to consider including in the FAQ. If we feel the question merits inclusion, we will include it along with a reply. We will not respond to your email individually.

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.