Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 需要设置新创建的网络用户的路径_C#_Asp.net_Windows_Ftp_Server - Fatal编程技术网

C# 需要设置新创建的网络用户的路径

C# 需要设置新创建的网络用户的路径,c#,asp.net,windows,ftp,server,C#,Asp.net,Windows,Ftp,Server,我正在用c代码创建一个网络用户。我每次都需要为用户设置一个正确的文件夹路径,因此这是否可行。如果可行,请帮助我完成此任务。此任务需要我三天的时间。我的代码如下: ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd.exe"); procStartInfo.UseShellExecute = true; procStartInfo.CreateNoWindow = true; procStartInfo.Verb = "ru

我正在用c代码创建一个网络用户。我每次都需要为用户设置一个正确的文件夹路径,因此这是否可行。如果可行,请帮助我完成此任务。此任务需要我三天的时间。我的代码如下:

 ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd.exe");
 procStartInfo.UseShellExecute = true;
 procStartInfo.CreateNoWindow = true;
 procStartInfo.Verb = "runas";
 procStartInfo.Arguments = "/env /user:" + "192.168.0.64/Administrator" + "cmd /K \"NET USER pky112 Admin123# /ADD    \"";

 procStartInfo.WindowStyle = ProcessWindowStyle.Normal;

 ///command contains the command to be executed in cmd
 System.Diagnostics.Process proc = new System.Diagnostics.Process();

 proc.StartInfo = procStartInfo;

 var sas=    proc.Start();

<> P>而不是创建另一个过程,考虑使用ASP.NET的内置模拟功能。在web.config文件中,配置以下内容:

<identity impersonate="true"
      userName="domain\user" 
      password="password" />

希望这有帮助

你面临什么错误/问题?我创建了一个ftp站点。现在,当我用这段代码创建一个网络用户并使用filezila访问时,ftp网站的完整路径将打开。但我只需要与用户共享一个文件夹。因此,我需要为新创建的用户设置路径。您希望通过执行c#application中的命令将用户分配到文件夹,对吗?当你自己使用这个命令时,它工作正常吗?问题只在于在c#中执行它,或者在午餐时命令有问题?请您在@cezaryth解释一下,上面的代码创建了一个单独的进程。这是什么类型的ASP.NET站点?Web表单,MVC?
userName="registry:HKLM\Software\AspNetIdentity,Name"
password="registry:HKLM\Software\AspNetIdentity,Password"