Q:

Pass basic authentication without prompting login box from browser in JSP frames

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? 

A:

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 

