public string encoding(string sentence, string from, string to, string gtk, string token) { var engine = new Jurassic.ScriptEngine(); engine.ExecuteFile(GlobalSettings.BaiduEncoder); string sign = engine.CallGlobalFunction <string>("token", sentence, gtk); BaiduRequest request = new BaiduRequest { from = from, to = to, query = sentence, transtype = "realtime", simple_means_flag = "3", sign = sign, token = token }; return(URLEncoding.GetQueryString(request)); }
public static void SetContentDisposition(this HttpResponse response, string fileName, bool inline) { string type = inline ? "inline" : "attachment"; response.Headers["Content-Disposition"] = $"{type}; filename=\"{URLEncoding.EncodePath(fileName)}\""; }