.net 使用process.start() 提示:系统找不到指定文件 2楼仁兄,这是服务器上的程序,从服务器执行nbtstat获取客户端MAC 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你先找找重装系统后系统目录还还有没有nbtstat.exe这个程序吧,有些安装包没带,就不能用了。 这个肯定有的,CMD下直接使用可以,但是用web程序调用就不行了 这个肯定有的,CMD下直接使用可以,但是用web程序调用就不行了 你web进程用的什么用户有执行权限吗 Web呀,那肯定是没有权限了,把Web权限提到管理员组去。 //获取本机真实MAC地址代码如下:using System;using System.Runtime.InteropServices;public partial class _Default : System.Web.UI.Page{ [DllImport("Iphlpapi.dll")] private static extern int SendARP(Int32 dest, Int32 host, ref Int32 mac, ref Int32 length); [DllImport("Ws2_32.dll")] private static extern Int32 inet_addr(string ip); protected void Page_Load(object sender, EventArgs e) { string IPAddress = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList[0].ToString(); string mac = ""; System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = "nbtstat"; p.StartInfo.Arguments = "-a " + IPAddress; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; p.Start(); string output = p.StandardOutput.ReadToEnd(); int len = output.IndexOf("MAC 地址 = "); if (len > 0) { mac = output.Substring(len + 8, 18); } this.txtmac.Text = mac; }} 帮我看下这段代码哪里出错了?? gridview中点击编辑,再点击添加之后,gridview的编辑行和添加行都出来!如何取消编辑行???? C#windows服务计时器问题 如何计算出两个日期格式的字符串相差几天 救急:WEB页面多用户时数据混乱 .net Repeater里放了TextBox控件,想在客户端计算TextBox值的总和?? WebControls.TreeView控件问题 请问动易CMS怎么做网站通用搜索引擎? 又一个简单问题 数据插不进数据库,麻烦大家帮帮忙,谢谢 连接问题! js 调用短信平台接口 点击按钮其他控件文本为空
Web呀,那肯定是没有权限了,把Web权限提到管理员组去。
using System.Runtime.InteropServices;public partial class _Default : System.Web.UI.Page
{
[DllImport("Iphlpapi.dll")]
private static extern int SendARP(Int32 dest, Int32 host, ref Int32 mac, ref Int32 length);
[DllImport("Ws2_32.dll")]
private static extern Int32 inet_addr(string ip); protected void Page_Load(object sender, EventArgs e)
{
string IPAddress = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList[0].ToString();
string mac = "";
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "nbtstat";
p.StartInfo.Arguments = "-a " + IPAddress;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string output = p.StandardOutput.ReadToEnd();
int len = output.IndexOf("MAC 地址 = ");
if (len > 0)
{
mac = output.Substring(len + 8, 18);
}
this.txtmac.Text = mac;
}
}