Below is the python code for getting cookies and it is worked as expected, and trying to convert this to C# but not getting the cookies. Any other way i can convert below Python code to respective C# code.
Python code:
data = {"login": user, "password": password}
response = session.post(url, headers=HTTP_HEADERS, data=data, verify = False)
response.raise_for_status()
result = session.cookies.get("auth_session")
C# code
CookieContainer Cookies = new CookieContainer();
String username = "xxx_priceyyy";
String password = "xxxx@6781119";
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
HttpWebRequest oRequest = WebRequest.Create("https://kube.xxx.com/") as HttpWebRequest;
oRequest.CookieContainer = Cookies;
oRequest.Method = "POST";
oRequest.KeepAlive = false;
oRequest.Headers.Add("Authorization", "Basic " + encoded);
Stream newStream = oRequest.GetRequestStream();
WebResponse oResponse = oRequest.GetResponse();
var responseString = new StreamReader(oResponse.GetResponseStream()).ReadToEnd();