For Programmers: Free Programming Magazines  


Home > Archive > Java Help > December 2004 > Re: Authroization Header and sendRedirect









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Authroization Header and sendRedirect
Ram

2004-12-21, 4:00 pm


I have the same problem with sending Authorization and redirecting the
url. Please help.

-Thanks
-Ram
-rgande@gmail.com

marcmnich9876@my-deja.com wrote:
> I'm trying to redirect from a servlet to a page
> that is username/password protected and normally
> pops up a "username and password" window. I want
> to prevent the window from coming up by sending
> the setHeader("Authorization",...) info.
>
> Has anyone got this to work?
>
> Here's what I am using:
>
> String authString = "someusername" + ":"
> + "mypassword";
> String auth = "Basic " +
> new sun.misc.BASE64Encoder
> ().encode(authString.getBytes());
> String bare = new
> sun.misc.BASE64Encoder().encode(authString.getByt\
> es());
>
> response.setHeader("Authorization", auth);
>
> response.sendRedirect
> ("http://www.somedomain.com");
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com