I want to do login script to Dark Orbit(they have changed web to https). So what I want are 2 things
1) Log in script (with name+password) -> post+get
2) Log in script just with session -> get+cookies
I know how requests work and right now I work on the 2nd solution but after adding cookies to that request it seems that it ignores them.(for http it works)
I am hopeless. I was able to do this Session login for ssl in php and python, but in C# it doesnt work, and I have no idea why. Do you have some kind of solution or tip ?
Thnx for your help.
PS: 100 EG to person who will succesfully help me with both types of login throught http requests(I dont want browser-object login)
My main code:
Code:
//string name = "jasomdarkorbit"; //string pass = "123456"; const string URL = "https://www.darkorbit.com"; string html = ""; string url = URL + "/indexInternal.es?action=internalStart"; //For getting fresh session for this request go to darkorbit.com log in with: name=jasomdarkorbit, password=123456. string cookies = "dosid=63660eb0d3b6fdc9dcc868c19cf3bf96;"; html = GET(url, cookies); Debug.WriteLine(html);
Code:
public static string GET(string url, string cookie = null) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"; request.Headers.Set(HttpRequestHeader.Cookie, cookie); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream responseStream = response.GetResponseStream(); StreamReader reader = new StreamReader(responseStream); string result = reader.ReadToEnd(); responseStream.Close(); reader.Close(); response.Close(); return result; }