?? webservice.cs
字號:
?using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
/// <summary>
/// Hello Word
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class WebService : System.Web.Services.WebService {
public WebService ()
{
//如果使用設計的組件,請取消注釋以下行
//InitializeComponent();
}
//HelloWord調用的方法
[WebMethod]
public string HelloWorld(string instr) {
string str = "服務器asp.net ajax得到了您輸入的信息:" + instr + "<br/>您的IP地址是:";
str += System.Web.HttpContext.Current.Request.UserHostAddress;//ip
str += "<br/>當前服務器的時間:";
str += DateTime.Now.ToLocalTime();//時間
return str ;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -