问一个关于http请求的问题
我用sniffer截取到一个登陆网站的http请求的data是一串16进制的数那我如何把这传16进制的数在程序中发送给服务器?因为http请求发送的只能是byte类型的
不知道其中的转换机制是怎么样的?
望各位大侠指教,不甚感激
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("requestUri"); request.Method = "GET"; request.Accept = "*/*"; request.CookieContainer = cc; request.ContentLength = 0; HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader objReader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("UTF-8")); string doc = objReader.ReadToEnd();
byte[] byteArray = Encoding.UTF8.GetBytes("your str"); requestUri = new Uri("http://xxxx/loginSubmit.action"); request = (HttpWebRequest)HttpWebRequest.Create(requestUri); request.Method = "POST"; request.Accept = "*/*"; request.Referer = "http://xxxx/login.jsp"; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; request.GetRequestStream().Write(byteArray, 0, byteArray.Length); request.GetRequestStream().Close(); response = (HttpWebResponse)request.GetResponse();