Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string szUsername = "c0relynx";
- string szPassword = "c0relynx";
- string szURL1 ="http://xx.xx.xx.xx/webdav/foobar1.txt";
- string szContent = String.Format(@"Date/Time: {0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());
- HttpWebRequest httpPutRequest = (HttpWebRequest)WebRequest.Create(szURL1);
- httpPutRequest.Credentials = new NetworkCredential(szUsername, szPassword);
- httpPutRequest.PreAuthenticate = true;
- httpPutRequest.Method = @"PUT";
- httpPutRequest.Headers.Add(@"Overwrite", @"T");
- httpPutRequest.ContentLength = szContent.Length;
- httpPutRequest.SendChunked = true;
- httpPutRequest.KeepAlive = true;
- Stream requestStream = httpPutRequest.GetRequestStream();
- requestStream.Write(Encoding.UTF8.GetBytes((string)szContent), 0, szContent.Length);
- requestStream.Close();
- HttpWebResponse httpPutResponse = (HttpWebResponse)httpPutRequest.GetResponse();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement