随笔分类 - ASP.NET
摘要:Encoding.UTF8.GetBytes(string.Format("{0}#{1}", "name", "pwd"))).ToUpper(); public static string GetMD5(byte[] bytes) { // Create a new instance of th
阅读全文
摘要:1.先创建一个类: public static class MyServiceProvider { public static IServiceProvider ServiceProvider { get; set; } } 2.Startup.cs中Configure方法中添加 MyService
阅读全文
摘要:dynamic type = (new Program()).GetType(); string currentDirectory = Path.GetDirectoryName(type.Assembly.Location);
阅读全文
摘要:/// <summary> /// POST请求 /// </summary> /// <param name="url"></param> /// <param name="payload">参数字符串</param> /// <returns></returns> public static s
阅读全文
摘要:/// <summary> /// 查询所有部门和人员树形数据 /// </summary> public class Tree { public long? id { get; set; } public string label { get; set; } public List<Tree> c
阅读全文
摘要://序列化 string json = JsonConvert.SerializeObject(mydata); //反序列化 data= JsonConvert.DeserializeObject<MyData>(json); //String转json JObject jo = (JObject
阅读全文
摘要:委托是一个类,它定义了方法的类型,使得可以将方法当作另一个方法的参数来进行传递,这种将方法动态地赋给参数的做法,可以避免在程序中大量使用If … Else(Switch)语句,同时使得程序具有更好的可扩展性。 .NET中可以通过委托进行进行方法的异步调用,在委托对象上调用BeginInvoke()时
阅读全文
摘要:在wwwroot下建立web.config 内容如下:< ?xml version="1.0" encoding="UTF-8"?>< configuration>< system.webServer>< security>< requestFiltering allowDoubleEscaping
阅读全文
摘要:不使用contentType: “application/json”则data可以是对象 使用contentType: “application/json”则data只能是json字符串
阅读全文
摘要:编译Rocket.Windows.Framework项目的时候提示如题的错误, 用记事本打开出错的几个项目的.csproj文件,把下面几行内容删掉就行了。 <SccProjectName>Svn</SccProjectName> <SccLocalPath>Svn</SccLocalPath> <S
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace QY.WebAPI.Models { [Serializable] public class ResultJs
阅读全文
摘要://定义参数 C#调取webapi var content = new FormUrlEncodedContent(new Dictionary<string, string>() { {"Id",Guid.Empty.ToString()}, {"data",DateTime.Now.ToStri
阅读全文
摘要:Dictionary dcic = JsonHelper.DataRowFromJSON(resultdepth); foreach (var depthkey in dcic.Keys) { if (depthkey.Contains("data")) { ...
阅读全文