R – ASP redirect that passes Basic Authorization in header


How can I cause a redirect in ASP (pre .NET) to carry the Basic Authorization header as the ASP request. We tried using the following code .

response.setHeader( "Authorization", "Basic " + strAuth );
response.sendRedirect( src );

The header is set on the response of the .asp, but not passed on to the request to the new page. Is there a way to make sure the Authorization header is attached to the resulting request?

Best Solution

Are you redirecting to another ASP "classic" page in the same site? If so, you're better off storing the auth string in a Session variable and/or using Server.Transfer. Server.Transfer will transfer execution to another ASP script, which will then have access to the Request object of the calling page.

Also... response.setHeader? In classic pre-.NET ASP? Classic ASP uses response.addheader and response.redirect, not response.setHeader and response.sendRedirect.

Maybe you're using On Error Resume next and you're not seeing the errors the code is actually generating. Because that code will not run.

Related Question