C# Website Login & webbrowser1 navigate problem // EASY
$30-250 USD
In Progress
Posted about 11 years ago
$30-250 USD
Paid on delivery
Hello,
I have an app which has 1 webbrowser, 1 richtextbox, 1 button.
I am using this code:
CookieCollection cookies = new CookieCollection();
HttpWebRequest request = (HttpWebRequest)[login to view URL]("[login to view URL]");
[login to view URL] = new CookieContainer();
[login to view URL](cookies);
//Get the response from the server and save the cookies from the first request..
HttpWebResponse response = (HttpWebResponse)[login to view URL]();
cookies = [login to view URL];
string getUrl = "[login to view URL]";
string postData = [login to view URL]("login={0}&password={1}&op=login", "XXXX", "XXXX");
HttpWebRequest getRequest = (HttpWebRequest)[login to view URL](getUrl);
[login to view URL] = new CookieContainer();
[login to view URL](cookies); //recover cookies First request
[login to view URL] = [login to view URL];
[login to view URL] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/[login to view URL] Safari/535.2";
[login to view URL] = true;
[login to view URL] = [login to view URL];
[login to view URL] = true;
[login to view URL] = "application/x-www-form-urlencoded";
byte[] byteArray = [login to view URL](postData);
[login to view URL] = [login to view URL];
Stream newStream = [login to view URL](); //open connection
[login to view URL](byteArray, 0, [login to view URL]); // Send the data.
[login to view URL]();
HttpWebResponse getResponse = (HttpWebResponse)[login to view URL]();
using (StreamReader sr = new StreamReader([login to view URL]()))
{
string sourceCode = [login to view URL]();
[login to view URL] = sourceCode;
}
[login to view URL]("[login to view URL]");
But the webbrowser1 doesn't navigate to [login to view URL] , because its asking the user / pass again, however in the richtextbox i can see that i am logged in..
maybe navigate must use a cookie as well?
thanks