1、input只允许输入数字(一般用于金额使用)
<input class="form-control" type="text" placeholder="请输入预计成本" autocomplete="off" onkeyup="value=value.replace(/[^d.]/g,'').replace('.','$#$').replace(/./g,'').replace('$#$','.')" />
2、模拟http请求的参数类型 application/json
var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://url"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = "{"user":"test"," + ""password":"bla"}"; streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); }