Process.Start()的语法 [英] Syntax of Process.Start()

查看:190
本文介绍了Process.Start()的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下代码:

I tried the below code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Diagnostics;


public partial class Test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        SecureString password= new SecureString();
      
       password.AppendChar( 'A' );
       password.AppendChar( 'a' );
       password.AppendChar( 's' );
       password.AppendChar( 'h' );
       password.AppendChar( 'i' );
       password.AppendChar( 's' );
       password.AppendChar( 'h' );


         try
         {
             Process.Start("Firefox.exe", "www.facebook.com","abc@y.com" ,password,".com");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
    }
    
}



错误:参数不正确.

正确的参数应该是什么?

:rose:
致以问候
Er.Aashish Khandelwal



Error: The parameter is incorrect.

What should the correct parameter be?

:rose:
With Regards
Er.Aashish Khandelwal

推荐答案

知道确切的错误是有帮助的,我得到:
It would help to know what the exact error is, I get:
Logon failure: unknown user name or bad password



那么,您得到的错误是什么?

尝试从命令行启动垃圾簿,查看需要提供哪些参数然后进行复制.



So what is the error you get?

Try launching wastebook from the command line, see which paramaters you need to supply and then replicate.


我不确定这是否可以编译.没有任何使用4个参数的Process.Start()重载版本.另外,如果您尝试使用Process.Start()自动登录网站,则我认为这是不可能的.


Process.Start(字符串文件名,字符串参数,字符串用户名,SecureString密码,字符串域);


以上陈述在语法上是正确的.

尽管该语句在语法上是正确的,但它与启动进程有关,即启动该进程的用户,用户的密码以及该用户所属的域.

这与发送到firefox的参数无关,这些参数包含在字符串参数中.

至于启动Firefox并登录到Facebook,我认为不可能
I''m not sure this will even compile. There aren''t any overloaded versions of Process.Start() that take 4 parameters. Additionally, if you are attempting to log into a website automatically using Process.Start(), I don''t think that is possible.


Process.Start(string filename , string arguments , string username , SecureString password , string domain);


Above statement is syntactically correct.

Although the statement is syntactically correct it is to do with launching the process i.e. which user to launch the process and their password and the domain the user belongs to.

This has nothing to do with the arguments sent to firefox which are covered in string arguments.

As for launching Firefox and logining into facebook I don''t think it is possible


域参数为"facebook.com".

我刚刚找到了此版本的Process.Start()的文档.我以前看过.net 2.0规范.您绝对无法以尝试的方式使用此功能.用户名是指您的域中的用户.密码是用户的密码. domain参数是用户所属的域.
The domain argument would be "facebook.com".

I just found the documentation for this version of Process.Start(). I was looking at the .net 2.0 spec''s before. You will definitely not be able to use this in the way you are attempting. The user name refers to a user in your domain. The password is the user''s password. the domain argument is the domain the user belongs to.


这篇关于Process.Start()的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆