Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Logoff/ReLogin to htaccess in one browser

by hatter (Pilgrim)
on Jul 10, 2002 at 11:17 UTC ( #180724=note: print w/ replies, xml ) Need Help??


in reply to Logoff/ReLogin to htaccess in one browser

I gave up looking for solutions to this problem, once I moved over to using more complicated authentication (my current back end intrinsically allows a prived user to pretend to be a lesser one) So as you'd expect, a solution prevented itself late one night shortly after.

What you need to do is force your webserver to report a 401 error (authentication required) This is the same as it normally reports when you try to access a protected directory, and your browser should then assume the credentials it previously supplied are no longer correct, and prompt you for username and password.

I suggested this to a friend having similar difficulties finding how to do it, and he reckons it works just peachy, except for a bug in one version of IE5.

the hatter


Comment on Re: Logoff/ReLogin to htaccess in one browser
Download Code
Re: Forcing Apache to spit out a 401
by LAI (Hermit) on Jul 10, 2002 at 13:33 UTC
    Good idea, hatter. But how would you do that? How would you force a 401? Can you do it by writing to the HTTP header directly? I'd love to see some code.

    LAI
    :eof

      A link like this might do the job:

      <a href="http://invalid:user@www.site.com/cgi-bin/page.cgi">logout</a>

      With CGI.pm, you ought to be able to do something like this untested code:

      use CGI $q = new CGI; print $q->header(-status=>'401 Authorization required'); # add code here to print the rest of the error document
      __________
      He seemed like such a nice guy to his neighbors / Kept to himself and never bothered them with favors
      - Jefferson Airplane, "Assassin"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://180724]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-11-23 07:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (129 votes), past polls