private void My_send_Click(object sender, System.EventArgs e)
{
string str;
str=MyText.Text;
System.Diagnostics.Process.Start("CMD.exe","/c net send 192.168.3.6 str ");
}我这样写肯定会发个消息给192.168.3.6,消息的内容为 str
但是我的本意,是发送一个MyText.Text到192.168.3.6不知道该怎么写?
大家帮忙
{
string str;
str=MyText.Text;
System.Diagnostics.Process.Start("CMD.exe","/c net send 192.168.3.6 str ");
}我这样写肯定会发个消息给192.168.3.6,消息的内容为 str
但是我的本意,是发送一个MyText.Text到192.168.3.6不知道该怎么写?
大家帮忙
{
string str;
str=MyText.Text;
System.Diagnostics.Process.Start("CMD.exe","/c net send 192.168.3.6 " + str);
}
System.Diagnostics.ProcessStartInfo
startInfo = new System.Diagnostics.ProcessStartInfo();
System.Diagnostics.Process p;
startInfo.FileName = "d:\\winnt\\system32\\net.exe";
startInfo.Arguments = "send 192.168.3.6 " + MyText.Text;
startInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden;
p = System.Diagnostics.Process.Start(startInfo);
p.WaitForExit();
System.Diagnostics.Process.Start("CMD.exe","/c net send 192.168.3.6 "+str );
{
System.Diagnostics.Process.Start("CMD.exe","/c net send 192.168.3.6"+ MyText.Text.Tostring() );
}
这样是不行的,没反应啊我再试2楼的,我想在这句做文章最好
方法同上,最简单的也就是:
private void My_send_Click(object sender, System.EventArgs e)
{
string str;
str=MyText.Text;
System.Diagnostics.Process.Start("CMD.exe","/c net send 192.168.3.6 "+str);
}
可能是你那个MyText.Text出了问题。
你先用具体的值试试看吧。
例如:方法同上:
private void My_send_Click(object sender, System.EventArgs e)
{
string str;
str="test the send";
System.Diagnostics.Process.Start("CMD.exe","/c net send 127.0.0.1"+str);
}
如果这样也不可以的话就是其他问题了
呵呵
问一个解决读取文本文件的问题(另开帖50)
page_load下:FileStream fs = new FileStream("e:\\通知.txt", FileMode.Open);
byte[] bytes = new byte[(int)fs.Length];
fs.Read(bytes, 0, bytes.Length);
fs.Close();
strNews = System.Text.Encoding.GetEncoding("gb2312").GetString(bytes);其中e盘下的 通知.txt 文件中 也把aspnet用户加里了,而且是最大的权限。
但是错误依旧:对路径“e:\通知.txt”的访问被拒绝。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.UnauthorizedAccessException: 对路径“e:\通知.txt”的访问被拒绝。 ASP.NET 未被授权访问所请求的资源。请考虑授予 ASP.NET 请求标识访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 {MACHINE}\ASPNET,在 IIS 6 上为网络服务)。如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。 若要授予 ASP.NET 对文件的写访问权,请在资源管理器中右击该文件,选择“属性”,然后选择“安全”选项卡。单击“添加”添加适当的用户或组。突出显示 ASP.NET 帐户,选中所需访问权限对应的框。源错误:
行 37: }
行 38:
行 39: FileStream fs = new FileStream("e:\\通知.txt", FileMode.Open);---这里
行 40: byte[] bytes = new byte[(int)fs.Length];
行 41: fs.Read(bytes, 0, bytes.Length);
还是不行呢,我的机器S_zzs
IUSR_S_zzs加了,还这个错误啊