I have created frame in JSP which takes some site in source which has basic authentication implemented
<frameset frameborder="0" border="0" framespacing="0">
<frame name="content" src="http://abc/" marginheight="0"
marginwidth="0" scrolling="auto" noresize>
but when this frame loads it prompts login box of browser.
What code should be used so that if I provide hardcoded user name and password, each time when I run site within the frame it loads site directly?
You can make an AJAX request with the Authorization
header having the authentication details, such that further requests join the session and does not need authentication.
Here it is to add the Authorization
header:
byte[] authBytes = Encoding.UTF8.GetBytes("user:password".ToCharArray());
String authHeaderValue = "Basic " + Convert.ToBase64String(authBytes);
//Add Authorization:authHeaderValue to the request
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With