c# - GetRequestStream() Timeout Really Wierd -
i wrote console application download files.
this application works fine @ end throw timeout webexception on client's end.
i tried debug program line line on client's end find line "using (var stream = myrequest.getresponse())" takes long time , timeout exception thrown.
i tried solutions found online, using statement @ places can use , aborted requests. still cant solve problem
any suggestions on problem?
string logindata = "*******"; cookiecontainer cookiecontainer = new cookiecontainer(); uri target=new uri("https://www.ftwilliam.com"); cookiecontainer.add(new cookie("corem_state", "8~-1~-1~-1~-1~3~3~5~3~3~7~7~|~~|~~|~~|~||||||~|~~|~~|~~|~~|~~|~~|~~|~") { domain = target.host }); cookiecontainer.add(new cookie("corem_state_content", "6~|~f83b1d2bfcf9ce7a~a063aa2fde6ff059~28d0274b261787bd~|~0~1~2") { domain = target.host }); cookiecontainer.add(new cookie("cmavid", "30011373332532185583597") { domain = target.host }); cookiecontainer.add(new cookie("cmtpset", "y") { domain = target.host }); httpwebrequest myrequest = (httpwebrequest)webrequest.create("https://www.ftwilliam.com/cgi-bin/enter.cgi"); myrequest.cookiecontainer = cookiecontainer; myrequest.method = "post"; myrequest.keepalive = true; myrequest.allowautoredirect = false; myrequest.referer = "https://www.ftwilliam.com/cgi-bin/enter.cgi"; myrequest.useragent = "mozilla/5.0 (windows nt 6.1; wow64; rv:26.0) gecko/20100101 firefox/26.0"; myrequest.contenttype = "application/x-www-form-urlencoded"; asciiencoding encoding = new asciiencoding(); byte[] logindatabytes = encoding.getbytes(logindata); myrequest.contentlength = logindatabytes.length; using(var stream = myrequest.getrequeststream()) { stream.write(logindatabytes, 0, logindatabytes.length); }
Comments
Post a Comment