C# function sample

  • 48
  • 0

C# function sample

[WebMethod(enableSession: true, Description = "fnABC")]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string fnABC(string token)
{
	DateTime start = DateTime.UtcNow;
	logger.Debug("[fnABC]pid=" + pid + ",token=" + token);
	string result = "";
	try
	{
		//驗證TOKEN
		
		//寫LOG
		logger.Debug("[fnABC]end共執行時間 : " + Convert.ToInt32((DateTime.UtcNow - start).TotalMilliseconds).ToString() + " 毫秒");
		return new JavaScriptSerializer().Serialize(result);
	}
	catch (Exception e)
	{
		logger.Error(e);
		return new JavaScriptSerializer().Serialize("FAIL!!" + e.Message);
	}
}

sample