0

Guys i am making c# windows application and i want to open any explorer (IE, FireFox, Chrome etc) with a website showing the login page asking me to enter my user name and password.

i am doing.

Process p =new Process();
ProcessStartInfo Sinfo=new ProcessStartInfo();
Sinfo.FileName="chrome.exe" //  or Sinfo.Filename="IExplorer.exe";
Sinfo.agruments="www.mail.yahoo.com";
p.startinfo=Sinfo;
p.start();

i am not getting how to send my email/username and password to specific website to login automatically?

Azeem Akram
  • 223
  • 6
  • 9
  • 21
  • Well, that may be because you won't be able to do so :-) You can not simply pass user name and password as parameters or something like that. You could try to send key events to the browser's window, but I doubt that this will work nicely. – Thorsten Dittmar May 25 '12 at 11:55
  • @ThorstenDittmar :: is there any example how to send key event to browser's window. actually i want that when i click on button then explorer open and automatically login to site. – Azeem Akram May 25 '12 at 12:12
  • Yes, Google knows many samples if you just search for "C# send keystroke process". One of them is this: http://stackoverflow.com/questions/825651/how-can-i-send-the-f4-key-to-a-process-in-c – Thorsten Dittmar May 25 '12 at 13:07

2 Answers2

0

Even if you were to post, most site these days have something called Cross Site Request Forgery (CSRF) protection which prevents someone from posting a form from somewhere else, unless they are on the site that allows it.

Gavin
  • 6,284
  • 5
  • 30
  • 38
-1

Passing the user name and password in the query string will only work if the target web site was programmed to accept those values in a query string.

Here is an example: link

Internet Engineer
  • 2,514
  • 8
  • 41
  • 54
  • I am responding to this question: i am not getting how to send my email/username and password to specific website to login automatically? – Internet Engineer May 25 '12 at 12:20
  • :: but my basic problem is that after clicking the button in my application i want to open explorer with a website suppose (http://mail.yahoo.com) opened and it is already login and showing my inbox or what ever page it displays after getting login. – Azeem Akram May 25 '12 at 12:47
  • That can only happen if yahoo is willing to accept credentials via query string. The problem is not on your side, its on theirs. In the past web sites allowed this, but these days they do not want robots creating scripts to login. – Internet Engineer May 25 '12 at 12:58