codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Please help!  Boogalou at 21:18 on Thursday, April 01, 2004
 

I really need help! Does any one know a code to pass word protect a web page? Like so people have to log in to view it? I saw one JS pass word protect on this site, but the pass word and username can be seen by going to source :S

  Re: Please help!  Troy Wolf at 20:12 on Friday, April 02, 2004
 

The methods are code your own or use built in OS or Webserver Software methods.

Web Server Software Methods
On Apache Web servers, there is an .htaccess file that can be configured to protect directories. On Microsoft IIS, it can be integrated with the OS folder security so that only specified Windows users can access the web resource. (But this requires you to setup your users in the Windows Active Directory -- not going to happen unless you control the server.) Are you managing your own webserver or are you hosting with a remote hosting company? What platform? (Most likely either IIS or Apache).

Roll your own
To do real authentication, it must be done server-side (not in client-side javascript). You can have a login system using only client-side javascript, but it will not be secure or reliable. What server-side scripting languages do you have available? If working with IIS, you will have ASP and/or ASP.Net. If Apache, you most likely have PHP, and probably PERL CGI as well.

The #1 downside to most roll your own solutions is that you can only protect scripts -- not every file type. For example, you may have an authentication system built and you include the protection in all your ASP pages, but anybody can still view your proprietary PDF, JPG, and HTML pages. For this reason, you would make all your HTML files ASP pages instead--but your other file types would be protected only by anonyminity. On Windows, I've heard about writing what is called an "ISAPI Filter" to protect files and entire directories, but I don't know anything about it.

I have written both an ASP and a PHP authentication system that I use in my projects. I am willing to share my strategy, but if you are not already an ASP or PHP programmer, it would probably be wasted time. Let us know which Web Server and which language, and we'll try to help from that angle. Also, at that time, let's repost this into the appropriate language forum. (Maybe David will relist it for us--if that's possible without too much hassle.)
Troy Wolf: site expert
SnippetEdit Website Editor









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  New LucidWorks certified distribution for Solr
•  Re: submit button on html form
•  Re: FREE TV on your PC!
•  Re: How to edit a PCL file
•  Re: How to open a pop up without Titlebar?
•  Re: Testing if object exists in IE
•  Re: windows service - web service - com
•  Re: Save up to 80% on SSL Certificates, RapidSSL Certificate @ $ 11.00/yr.
•  Re: Using ASP to write RTF


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010