Tag: 爵士乐

c# – 使用Cookie的WebRequest HTTP POST(来自curl脚本的端口)

IBM RTC RESTful api提供了一个用于向服务器进行身份validation的shell脚本示例: COOKIES=./cookies.txt USER=my_user PASSWORD=my_password HOST=”https://myJazzServer:9092/jazz” curl -k -c $COOKIES “$HOST/authenticated/identity” curl -k -L -b $COOKIES -c $COOKIES -d j_username=$USER -d j_password=$PASSWORD “$HOST/authenticated/j_security_check” 这非常有效,但我需要使用c#对服务器进行身份validation。 到目前为止,我有以下内容,但它无法正常工作(返回授权失败页面): CookieContainer _cookie; public string _RTC() { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(“https://myJazzServer.com:9092/jazz/authenticated/identity”); if (_cookie == null) { _cookie = new CookieContainer(); } string a; request.CookieContainer = _cookie; using (var response […]