protected T Post <T>(string url, string post, int timeout = Config.TIME_OUT) where T : class { WebClientEx web = new WebClientEx(); web.ResetHeaders(); web.Encoding = Encoding.UTF8; web.SetTimeOut(timeout); var json = web.UploadString(url, "POST", post); return(Deserialize <T>(json)); }
protected T PostFile <T>(string url, string file, object obj, int timeout = Config.TIME_OUT) where T : class { WebClientEx web = new WebClientEx(); web.ResetHeaders(); web.Encoding = Encoding.UTF8; web.SetTimeOut(timeout); var bytes = web.UploadFile(url, file); var json = Encoding.UTF8.GetString(bytes); return(Deserialize <T>(json)); }