I've done this a few times, and it does work very well. The only drawback I've encountered is that helpful browsers tend to make it very hard to log out without quitting (or to enforce an inactivity timeout), and you need special mechanisms to achieve a permanent login (which may seem like an advantage).

The only way I'm aware of to force login or logout, which might incidentally answer your specific question, is to redirect the user to an address in the form http://user:password@foo.bar.com/baz/. Which is how my heath-robinson logout mechanism worked, but obviously isn't great for logging in.

but i'm surprised you don't like the standard browser login window: it always seemed reassuring to me that this was the real thing and not some home-made cookie cutter.

incidentally, for working with htpasswd files I would highly recommend KM's Apache::Htpasswd.


In reply to Re: Integrating htpasswd and CGI by thpfft
in thread Integrating htpasswd and CGI by George_Sherston

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.