webrequest

Reading and modifying the HTTP GET request in a Chrome extension

こ雲淡風輕ζ 提交于 2019-12-06 08:54:25
I would like to read and modify (add) HTTP headers in a Chrome extension. I am using the chrome.webRequest API for the same. But i am still not able to read it. Here's my code. chrome.webRequest.onBeforeSendHeaders.addListener( function(details) { details.requestHeaders.push({name:"dummyHeader",value:"1"}); return {requestHeaders: details.requestHeaders}; }, {urls: ["<all_urls>"]}, ["requestHeaders"] ); What am i missing? You need to add the "blocking" flag to the ExtraInfoSpec list in order to pause the request. Without this flag, the return value of an onBeforeSendHeaders event listener is

Why does sending post data with WebRequest take so long?

心已入冬 提交于 2019-12-06 08:10:58
I am currently creating a C# application to tie into a php / MySQL online system. The application needs to send post data to scripts and get the response. When I send the following data username=test&password=test I get the following responses... Starting request at 22/04/2010 12:15:42 Finished creating request : took 00:00:00.0570057 Transmitting data at 22/04/2010 12:15:42 Transmitted the data : took 00:00:06.9316931 <<-- Getting the response at 22/04/2010 12:15:49 Getting response 00:00:00.0360036 Finished response 00:00:00.0360036 Entire call took 00:00:07.0247024 As you can see it is

web request timeout handling?

北城以北 提交于 2019-12-06 03:47:27
问题 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Timeout = 20000; using (WebResponse response = request.GetResponse()) using (var stream = response.GetResponseStream()) using (var reader = new StreamReader(stream)) { var result = reader.ReadToEnd(); // Do something with result } In the above example I have a timeout defined, if it happens to hit the timeout how would I know, the result would be empty ? Do I receive any reponse types ? How can I make sure I got timed

Android webrequest simple solution

我怕爱的太早我们不能终老 提交于 2019-12-06 02:46:00
问题 I want to connect to a web-server (a page) via a simple URL which already contains any parameters I want to sent, like : www.web-site.com/action.php/userid/42/secondpara/23/ and then get the page content which is generated by the site (won't be morde than a simple OK/NOK). How can I manage to do this? I failed to find any example-code or documentation which seems to fit my problem. Thx for helping. 回答1: try this: public static void connect(String url) { HttpClient httpclient = new

How to close IE sessions opened by Invoke-WebRequest

青春壹個敷衍的年華 提交于 2019-12-05 21:44:40
I am noticing in my script that Invoke-WebRequest is launching Internet Explorer (presumably to parse the DOM). Is there a way to close down these IE sessions at the end of my script, for cleanup purposes? The line highlighted in red is the iwr which prompts Internet Explorer to open. If I add -UseBasicParsing to that $AllRegs request, the script fails a couple lines later, trying to capture $LibraryID To forcefully close all IE sessions use: get-process iexplore | stop-process To more gracefully close IE sessions use: Get-Process iexplore | ForEach-Object { $_.CloseMainWindow() } You can also

Http web request doesn't maintaining session

本小妞迷上赌 提交于 2019-12-05 20:13:57
I have program where i want to scrap some Useful study material for me. This site maintaining session key and some other key also. If I trying to go nested page then it will throw me out and show session out message. I unable to maintain session key in web request class. so please give me some idea that how can i maintain session in web request class. You need to maintain the CookiesCollection across your requests. var request = (HttpWebRequest)HttpWebRequest.Create("http://www.mysite.com/"); var cookies = new CookieContainer(); //Pass the collection along with each request to maintain session

Run x number of web requests simultaneously

泪湿孤枕 提交于 2019-12-05 19:53:40
Our company has a web service which I want to send XML files (stored on my drive) via my own HTTPWebRequest client in C#. This already works. The web service supports 5 synchronuous requests at the same time (I get a response from the web service once the processing on the server is completed). Processing takes about 5 minutes for each request. Throwing too many requests (> 5) results in timeouts for my client. Also, this can lead to errors on the server side and incoherent data. Making changes on the server side is not an option (from different vendor). Right now, my Webrequest client will

HttpWebRequest.GetRequestStream() breaks by timeout on SSL connection under Windows 7/Vista

廉价感情. 提交于 2019-12-05 18:22:46
问题 I have an C# windows application (.Net 3.0 Framework) that makes a call to PHP web service using HttpWebRequest . In Win 7 & Vista , if the call is made via non-SSL (i.e. http:// ), the code works fine. When the call is changed to call the SSL(https:) version of the link, it times out at the HttpWebRequest.GetRequestStream() . This happens every time. When this same application is run on a Windows XP machine it works fine with either the HTTP or the HTTPS url being used. The code does have

C# WebRequest Login Session

送分小仙女□ 提交于 2019-12-05 17:49:09
Okay I tried asking this question yesterday but i'm not sure if I gave enough info, i got an answer but it hasn't worked for me. Basically what i'm doing is the user opens this windows forms application and logs in. Afterwhich they enter some text into a textbox and click run. At this point the run function is making a webrequest to a server that requires a login (the login that is initially done after they open the program. For some reason its still not seeing that the user is logged in when performing the second request even though the cookies are added too a cookie container. I'm not sure

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host in C#

我与影子孤独终老i 提交于 2019-12-05 12:50:45
I have a code where I am sending the URL request and receiving the response and storing it as a String as public String GenerateXML(String q)// Here 'q' is the URL { // Generating the XML file for reference // Getting the response in XML format from the URL Debug.WriteLine("The Http URL after URL encoding :" + q); try { Uri signs1 = new Uri(q); //Debug.WriteLine("The Requested URL for getting the XML data :" + re); WebRequest request1 = WebRequest.Create(signs1); HttpWebResponse response1 = (HttpWebResponse)request1.GetResponse(); //HttpWebResponse response1 = (HttpWebResponse)request1