I'm trying to redirect to a page that uses basic authentication. The only way I have got it to work so far is by adding username:password@url
to the url of the page I'm trying to redirect to, which does not work if the web app is used in an Iframe.
The second method I have tried is the code shown here. In the response I get a status Ok but when trying to redirect to the url return in the response, the page will prompt a basic authentication pop up.
var username = "username";
var password = "password";
var client = new RestClient(url);
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.UseDefaultCredentials = true;
client.Authenticator = new HttpBasicAuthenticator(username,password);
client.PreAuthenticate = true;
// Have also used the line above instead, they both return status OK
// request.AddHeader("Authorization", "Basic " + svcCredentials)
IRestResponse response = client.Execute(request);
return Redirect(response.ResponseUri.ToString());