tags:

views:

49

answers:

2

i am tying to login using System.Diagnostics.Process.Start

private void button1_Click(object sender, EventArgs e)

        {
        System.Diagnostics.Process.Start("iexplore","[email protected]","password","http://www.gmail.com");

    }

but visual studio gives me these 2 errors: Error 1 The best overloaded method match for 'System.Diagnostics.Process.Start(string, string, System.Security.SecureString, string)' has some invalid arguments C:\Documents and Settings\Omair\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs 21 13 WindowsFormsApplication3

and

Error 2 Argument '3': cannot convert from 'string' to 'System.Security.SecureString' C:\Documents and Settings\Omair\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs 21 80 WindowsFormsApplication3

note: i am brand new to c# and reletively new to the world of programming sorry for my english

A: 

Secure string is a "Special" type of string in the .net framework. It's encrypted.

Here is how to convert a string to a secure string: http://social.msdn.microsoft.com/Forums/en-SG/netfxbcl/thread/ada5def5-0d80-43d6-ab5d-9fb1934e6556

Another example: http://davidhayden.com/blog/dave/archive/2006/03/04/2873.aspx

This being said, I don't think this will achieve what you want it to. The username and password option on process start is for starting the application (IE in your case) and running it under a different account.

MSDN SecureString
MSDN Process Start

Kevin
then how to login to gmail progamatically? can you point to an example?note:an ''easy for biggener'' example would be nice
Omair Iqbal
A: 

Your approach is not going to work. GMail is not a regular Windows program, the kind that you can start with Process.Start(). It is coded in Javascript and runs in your browser. The login procedure is handled by Javascript.

You'll need a browser plug-in to tinker with GMail. A popular one that works on Firefox is Greasemonkey. Lots of GMail hacks in this google query.

Hans Passant