简体   繁体   English

无法使用System.Diagnostics.Process.Start登录

[英]cant login using System.Diagnostics.Process.Start

i am tying to login using System.Diagnostics.Process.Start 我想使用System.Diagnostics.Process.Start登录

private void button1_Click(object sender, EventArgs e)

        {
        System.Diagnostics.Process.Start("iexplore","username@gmail.com","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 但是Visual Studio却给我这两个错误:错误1“ System.Diagnostics.Process.Start(字符串,字符串,System.Security.SecureString,字符串)”的最佳重载方法匹配具有一些无效的参数C:\\ Documents and Settings \\ Omair \\我的文档\\ 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 错误2参数“ 3”:无法从“字符串”转换为“ 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 注意:我是C#的新手,并且是编程世界的新手。对不起,我的英语

Secure string is a "Special" type of string in the .net framework. 安全字符串是.net框架中的“特殊”类型的字符串。 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 这是将字符串转换为安全字符串的方法: 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 另一个示例: 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. 进程启动时的用户名和密码选项用于启动应用程序(在您的情况下为IE)并在其他帐户下运行。

MSDN SecureString MSDN SecureString
MSDN Process Start MSDN 流程开始

Your approach is not going to work. 您的方法行不通。 GMail is not a regular Windows program, the kind that you can start with Process.Start(). GMail不是常规的Windows程序,可以从Process.Start()开始。 It is coded in Javascript and runs in your browser. 它用Javascript编码并在您的浏览器中运行。 The login procedure is handled by Javascript. 登录过程由Javascript处理。

You'll need a browser plug-in to tinker with GMail. 您需要一个浏览器插件才能修改GMail。 A popular one that works on Firefox is Greasemonkey. 可以在Firefox上运行的流行工具是Greasemonkey。 Lots of GMail hacks in this google query . 这个Google查询中有许多GMail骇客。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM