webrequest

Failed to get response for large file HTTP put create file using c#

♀尐吖头ヾ 提交于 2019-12-02 05:31:47
Failed to get response for large file HTTP put create file using c# I am using file watcher service service monitor, when user created file or folder we are uploading to cloud if file size more than 512 MB it is taking too much time to get the response here I am confusing here the issue with my code or server and reason for this error if any changes on my code suggest me. { var fileFolderObj1 = new FileFolder(); var postURL = apiBaseUri + "/filefolder/create/file/user/" + userId; // +"?type=file"; code = HttpStatusCode.OK; HttpWebResponse response = null; FileInfo f = new FileInfo(filePath);

How to send / receive cURL/API requests in C#

两盒软妹~` 提交于 2019-12-02 04:44:48
问题 i have problems with my c# programm to send or receive cURL requests to a online telephone system, i hope to get some help there :) I want to send commands like this: curl https://api.placetel.de/api/test \ -d 'api_key=XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX' the server send in XML back <?xml version="1.0" encoding="UTF-8"?> <hash> <result>1</result> <result-code>success</result-code> <descr>test login successful v1.1</descr> </hash> i have try with the

How to send POST request with parameters asynchronously in windows phone 8

半城伤御伤魂 提交于 2019-12-02 03:36:25
I would like to send POST request in windows phone 8 environment my code is running successfully but i am getting NotFound exception. Its mean is i want to POST some data but i am sending null. So please let me know how to send POST Request asynchronously with Data in windows phone 8 environmet. I tried following links but not helpful. link link2 I approached like this private async Task<LastRead> SyncLastReadPOST(LastRead lastreads, bool actionStatus) { string jsondata = ""; actionStatus = false; apiData = new LastReadAPI()//It is global variable from apiData this object has the information {

Upload file uploaded via HTTP to ASP.NET further to FTP server in C#

╄→гoц情女王★ 提交于 2019-12-01 12:37:05
Upload form: <form asp-action="Upload" asp-controller="Uploads" enctype="multipart/form-data"> <input type="file" name="file" maxlength="64" /> <button type="submit">Upload</button> Controller/File upload: public void Upload(IFormFile file){ using (WebClient client = new WebClient()) { client.Credentials = new NetworkCredential("xxxx", "xxxx"); client.UploadFile("ftp://xxxx.xxxx.net.uk/web/wwwroot/images/", "STOR", file.FileName); } } Problem: Getting error "Could not find file xxxx" . I understand the issue is that it's trying to find the file as it is "C:\path-to-vs-files\examplePhoto.jpg"

Upload file uploaded via HTTP to ASP.NET further to FTP server in C#

▼魔方 西西 提交于 2019-12-01 10:58:30
问题 Upload form: <form asp-action="Upload" asp-controller="Uploads" enctype="multipart/form-data"> <input type="file" name="file" maxlength="64" /> <button type="submit">Upload</button> Controller/File upload: public void Upload(IFormFile file){ using (WebClient client = new WebClient()) { client.Credentials = new NetworkCredential("xxxx", "xxxx"); client.UploadFile("ftp://xxxx.xxxx.net.uk/web/wwwroot/images/", "STOR", file.FileName); } } Problem: Getting error "Could not find file xxxx" . I

using chrome.experimental.webRequest API to change loaded file?

寵の児 提交于 2019-12-01 08:40:48
I'm trying to use webRequest API to change the loaded .swf file on a webpage... The page loads a file called chat.swf, but i want to redirect to chat2.swf in the same directory in order to use the other file. I was told that this could work, but I have no idea how to use this API correctly and I cannot find any examples @_@ function incerceptChat(chat){ console.log( "onBeforeRequest", details ); if(chat.url == swf1){ chat = swf2; } } that's my function that's supposed to change the URL, but I have been unable to get it to work (probably wrong syntax somewhere...) and I'm using this to listen:

Sending Basic authentication over http

偶尔善良 提交于 2019-12-01 05:26:11
I am trying to read the source from a page that requires basic authentication. However, using a Header and even Credentials in my HttpWebRequest, I still get a Unauthorized Exception [401] returned. string urlAddress = URL; string UserName = "MyUser"; string Password = "MyPassword"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlAddress); if (UserName != string.Empty) { string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(UserName + ":" + Password)); request.Headers.Add("Authorization", "Basic " + encoded); System.Net

chrome.webRequest.onAuthRequired Listener

核能气质少年 提交于 2019-12-01 03:45:10
i'm trying to intercept the proxy authorization inside a chrome extension. Following the answer to here: Domain Authorization in Chrome Extension and reading the docs here my code looks like this: chrome.webRequest.onAuthRequired.addListener( function(details, callbackFn) { console.log("onAuthRequired!", details, callbackFn); //callback({ // authCredentials: {username: "1", password: "__TestUse"} //}); }, {urls: ["<all_urls>"]} ); The problem is that callbackFn is undefined but should be a function. Anyone got some ideas why callbackFn is undefined. As I read the docs I'm doing it right ..

Using .NET to Post a file to Server HttpWebRequest or WebClient

北城以北 提交于 2019-12-01 03:41:12
Okay so here is the deal. As the question states, I'm trying to POST a file to a webserver and am having a few issues. I've tried posting this same file to the same webserver using Curl.exe and have had no issues. I've posted the flags I used with curl just incase they might point out any potential reasons why I'm having trouble with the .NET classes. curl.exe --user "myUser:myPass" --header "Content-Type: application/gzip" --data-binary "@filename.txt.gz" --cookie "data=service; data-ver=2; date=20100212; time=0900; location=1234" --output "out.txt" --dump-header "header.txt" http://mysite

System.Net.ProtocolViolationException: You must write ContentLength bytes to the request stream before calling [Begin]GetResponse

╄→尐↘猪︶ㄣ 提交于 2019-12-01 02:41:35
I am getting the "System.Net.ProtocolViolationException: You must write ContentLength bytes to the request stream before calling [Begin]GetResponse" error when calling to the "BeginGetResponse" method of the web request. This is my code: try { Stream dataStream = null; WebRequest Webrequest; Webrequest = WebRequest.Create(this.EndPointAddress); Webrequest.Credentials = new NetworkCredential(this.username, this.password); Webrequest.ContentType = "text/xml"; Webrequest.Method = WebRequestMethods.Http.Post; byteArray = System.Text.Encoding.UTF8.GetBytes(xmlRequest.Children[0].InnerXML);