?? demomethods.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
/// <summary>
/// DemoMethods 的摘要說明
/// </summary>
public class DemoMethods
{
public DemoMethods()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
[Ajax.AjaxMethod]
public string GetCustomerMac(string clientIP)
{
string mac = "";
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "nbtstat";
process.StartInfo.Arguments="-a"+clientIP;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
int length = output.IndexOf("MAC Address = ");
if (length > 0)
{
mac = output.Substring(length + 14, 17);
}
process.WaitForExit();
return clientIP;
}
[Ajax.AjaxMethod]
public DataSet getdataset()
{
DataTable table = new DataTable();
DataColumn column = new DataColumn();
string row = "sample";
table.Columns.Add(column);
table.Rows.Add(row);
column.ColumnName = "firstname";
DataSet ds = new DataSet();
ds.Tables.Add(table);
return ds;
}
[Ajax.AjaxMethod]
public string GetXML()
{
StringBuilder sb = new StringBuilder();
sb.Append("<state>");
sb.Append("<city>北京</city>");
sb.Append("<city>上海</city>");
sb.Append("<city>大連</city>");
sb.Append("<city>天津</city>");
sb.Append("</state>");
return sb.ToString();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -