⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demomethods.cs

📁 实际是NET使用AJAX的学习例子.为使用AJAX初学的同志.提供入门帮助与学习.
💻 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 + -