I need to redirect a user from one web page to a page hosted on a different server secured using basic authentication over SSL. From the first page, I want to pass the username/password in the header using basic authentication. The intent is to try and provide a single sign on type feel. I don't want the user being prompted for credentials when they hit the second page, thus passing the credentials in the header. Javascript, Python or PHP are OK, I do not want to use "Microsoft technologies". T.his is my actual (not working) code:
<script>
function redirectToContent(){
HttpContext httpContext = HttpContext.Current;
string authHeader = this.httpContext.Request.Headers["Authorization"];
string encodedUsernamePassword = authHeader.Substring("Basic ".Length).Trim();
Encoding encoding = Encoding.GetEncoding("UTF-8");
string usernamePassword = encoding.GetString(Convert.FromBase64String(encodedUsernamePassword));
int seperatorIndex = usernamePassword.IndexOf(':');
var username = usernamePassword.Substring(0, seperatorIndex);
var password = usernamePassword.Substring(seperatorIndex + 1);
document.getElementById("username").innerHTML = username;
document.getElementById("password").innerHTML = password;
window.location.replace=window.location.protocol + "//" + username + ":" + password + "@" +'www.librojanasincantu.eu/page115.html';
}
</script>