From a.com/Search.aspx, open b.com/Contain.aspx page. Bypass the b.com/login.aspx page by API calling and open b.com/contain.aspx page.
a.com hosted by me and b.com manage by some external vendor.
What I have tried:
In a.com/Search.aspx page I written below code to call b.com login page api and able to successfully read the cookies values
var client = new RestClient("http://b.com/jjweb/app?username=jj_123&password=XXXX");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
IList<restresponsecookie> res = response.Cookies;
string JSessionID = string.Empty;
string JJSessionID = string.Empty;
string JJAccessToken = string.Empty;
JSessionID = response.ResponseUri.AbsolutePath.Split(';')[1].Split('=')[1].ToString();
foreach (RestResponseCookie item in res)
{
if (item.Name.ToUpper() == "JJSESSIONID")
JJSessionID = item.Value;
else
JJAccessToken = item.Value;
}
System.Diagnostics.Debug.WriteLine("JSESSIONID={0}; JJSESSIONID={1}; JJACCESSTOKEN={2}", JSessionID, JJSessionID, JAccessToken);
Response.Cookies["JSESSIONID"].Value = JSessionID;
Response.Cookies["JSESSIONID"].Expires = DateTime.Now.AddMinutes(1);
Response.Cookies["JJSESSIONID"].Value = JJSessionID;
Response.Cookies["JJSESSIONID"].Expires = DateTime.Now.AddMinutes(1);
Response.Cookies["JJACCESSTOKEN"].Value = JJAccessToken;
Response.Cookies["JJACCESSTOKEN"].Expires = DateTime.Now.AddMinutes(1);
Response.Write("");
Response.Write("window.open('http://b.com/jjweb/Contain.aspx?page=ScreenHtml5&service=page&offset=0&quickrewindsec=-5&quickadvancesec=5','_blank')");
Response.Write("");
Now I want to open b.com/Contain.aspx page, in new window with cookies.
Please suggest any code or work around to archive this