Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Logoff/ReLogin to htaccess in one browser

by hatter (Pilgrim)
on Jul 10, 2002 at 11:17 UTC ( [id://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

Replies are listed 'Best First'.
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

      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"

      A link like this might do the job:

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found