目錄
1.通用
1.1.轉小寫 大寫 ----string.ToLower()、 string.ToUpper()
2.一般處理程序
2.1基礎框架
3.aspx.cs
4.webapi
1.通用
1.1.轉小寫 大寫 ----string.ToLower()、 string.ToUpper()
//轉小寫
string strLow = "hello MAN";
strLow = strLow.ToLower();
//結果: strLow="hello man"
//轉小寫
string strUpper = "hello WOMAN";
strUpper = strUpper.ToUpper();
//結果: strLow="HELLO WOMAN"
2.一般處理程序
2.1基礎框架
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace DEMO.Web.modules.other
{
/// <summary>
/// Other 的摘要說明
/// </summary>
public class Other : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string strContent = ""; //要調用的方法名稱
//獲取前臺傳參,將參數名全部轉小寫
string HandleType = context.Request["HandlerType"].ToLower();
switch (HandleType)
{
case"loaddata": //
strContent = fLoadData(context);
break;
}
context.Response.Write(strContent);
}
public bool IsReusable
{
get
{
return false;
}
}
#region 加載內容-信息總覽
private string fLoadData(HttpContext context)
{
Hashtable ht = new Hashtable(); //返回內容
ht.Add("name", "張三");
return JsonConvert.SerializeObject(ht); //將返回結果 轉爲json,序列化
}
#endregion
}
}