Не удается отправить post запрос - C#
Формулировка задачи:
Не могу отправить post запрос
Мой код
Ссыль на источник
То что я понял так это что оно не вставляет пароль, а просто меняет серую запись "здесь вводите пароль", кто знает как решить, буду рад
private void button1_Click(object sender, EventArgs e) { string Auth = send("https://www.buenastareas.com/login.php", "username=removed@mail.ru&password=11101110aA"); } public string send(string url, string par) { String secondStepForm3 = par; HttpWebRequest request3 = (HttpWebRequest)WebRequest.Create(url); request3.CookieContainer = new CookieContainer(); request3.UserAgent = "Opera/9.80"; request3.Method = "POST"; request3.ContentType = "application/x-www-form-urlencoded"; byte[] EncodedPostParams3 = Encoding.Default.GetBytes(secondStepForm3); request3.ContentLength = EncodedPostParams3.Length; request3.GetRequestStream().Write(EncodedPostParams3, 0, EncodedPostParams3.Length); request3.GetRequestStream().Close(); HttpWebResponse response = (HttpWebResponse)request3.GetResponse(); string lol = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd(); return lol; } }
Решение задачи: «Не удается отправить post запрос»
textual
Листинг программы
<!DOCTYPE html> <!--[if IE 8]><html class="lt-ie9" xmlns="http://www.w3.org/1999/xhtml" lang="es"> <![endif]--> <html xmlns="http://www.w3.org/1999/xhtml" lang="es"> <head> <script type="text/javascript"> var sm = sm || {}; sm.data = sm.data || {}; sm.data.user = sm.data.user || {}; sm.data.page = sm.data.page || {}; sm.data.user.userId = null; </script> <script type="text/javascript">var sm = sm || {}; sm.tplVars = {"essaysImgCdnUrl":"\/\/images-study.netdna-ssl.com\/pi\/","useDefaultThumbs":true,"defaultThumbImgs":["\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_4.png","\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_2.png","\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_3.png","\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_4.png","\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_5.png"],"thumb_default_size":"160x220","thumb_ac_size":"80x110","isPayOrJoin":false,"essayUpload":true,"site_id":2,"autoComplete":false,"isPremiumCountry":false,"userCountryCode":"UA","logPixelPath":"\/\/www.smhpix.com\/pixel.gif","tracking_url":"\/\/www.smhpix.com\/pixel.gif","cookies":{"unlimitedBanner":"off"}}</script><!-- Google Tag Manager --> <script> window.dataLayer = window.dataLayer || []; dataLayer.push({"changeset":{"code":"5862def78c03"}}); dataLayer.push({"env":"production"}); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WBGFMB'); window.dataLayer = window.dataLayer || []; </script> <!-- End Google Tag Manager --><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" > <meta name="description" content="Introduce tu nombre de usuario y contraseГ±a para acceder a BuenasTareas.com." > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" > <title>Inicia sesiГіn en BuenasTareas.com</title><!-- global CSS --> <link href="//bts-study.netdna-ssl.com/5862def78c03/_assets/bts/0bbbc4dc8cdf75fa4e8be457b7ee4089.css" media="screen" rel="stylesheet" type="text/css" > <!-- end global CSS --><link rel="canonical" href="http://www.buenastareas.com/login.php" /><link href="/bts/images/favicon.ico" rel="icon" > <link href="//bts-study.netdna-ssl.com/5862def78c03/_assets/bts/434990c8a25d2be94863561ae98bd682.css" media="all" rel="stylesheet" type="text/css" > <!--[if lte IE 8]> <link href="//bts-study.netdna-ssl.com/5862def78c03/assets/blackboard/styles/ie8-and-down.css" media="screen" rel="stylesheet" type="text/css" ><![endif]--><script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(["pgt._setAccount", "UA-18439344-1"]); _gaq.push(["pgt._setAllowAnchor", true]); _gaq.push(["pgt._setSiteSpeedSampleRate", 0]); _gaq.push(["pgt._setCustomVar", 2, "changeset", "5862def78c03"]); /*start-search-abtest*/ /*end-search-abtest*/ _gaq.push(["pgt._trackPageview"]); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script><script type="text/javascript"> var _qevents = _qevents || []; (function() { var elem = document.createElement('script'); elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js"; elem.async = true; elem.type = "text/javascript"; var scpt = document.getElementsByTagName('script')[0]; scpt.parentNode.insertBefore(elem, scpt); })(); </script> <link rel="apple-touch-icon" href="//bts-study.netdna-ssl.com/5862def78c03/bts/images/m/apple-touch-icon.png"/> <link rel="apple-touch-icon-precomposed" href="//bts-study.netdna-ssl.com/5862def78c03/bts/images/m/apple-touch-icon-precomposed.png" /> </head> <body class="no-user "> <!-- Google Tag Manager noscript--> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-WBGFMB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager noscript--> <!-- start-qualaroo --> <script type="text/javascript"> var _kiq = _kiq || []; (function(){ setTimeout(function() { var d = document, f = d.getElementsByTagName('script')[0], s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '//s3.amazonaws.com/ki.js/56278/e4A.js'; f.parentNode.insertBefore(s, f); } , 1); })(); </script> <!-- end-qualaroo --> <div class="body"> <!-- Adding Mobile Roadblock for all sites --> <!--start-roadblock--> <!--end-roadblock--> <div class="BN-announcement"></div> <div class="header-container"> <div class="fluid-container" id="header"> <div class="container "> <div class="row"> <div class="header-box col-xs-6 col-sm-11 col-md-9 col-lg-9 left"> <!--start-logo--> <div id="logo"> <a href="/" title="Buenas Tareas - Ensayos, trabajos finales y notas de libros premium y gratuitos | BuenasTareas.com">Buenas Tareas - Ensayos, trabajos finales y notas de libros premium y gratuitos | BuenasTareas.com </a> </div> <!--end-logo--> </div> <div id="user-account-menu" class="col-xs-6 col-sm-1 col-md-3 col-lg-3 right search-not-available"> </div> </div> </div> <!--start-reg-banner--> <div class="hidden comp-reg-banner"></div> <!--end-reg-banner--> </div> </div> <div class="right-side-panel"> </div> <div class="fluid-container"> <div class="fluid-container login"> <div class="container page-body"> <div class="row"> <div class="col-lg-12"> <h1> Ingresa en tu cuenta </h1> </div> <div class="col-sm-8 form"> <div> <div class="userMessage error"> <ul> <li>Tu correo electrГіnico, nombre de usuario o contraseГ±a es invГЎlido. <a href="/forgot.php"><!-- Restablecer tu contraseГ±a. --></a></li> </ul> </div> <form id="login" name="login" enctype="application/x-www-form-urlencoded" method="post" class="formClass" action="/login.php"> <ul> <li> <label for="username" class="required"> CORREO ELECTRГ“NICO O NOMBRE DE USUARIO </label> <input type="text" name="username" id="username" value="espano_Ade@gmail.com" placeholder="CORREO ELECTRГ“NICO O NOMBRE DE USUARIO" class="txt form-control"> </li> <li> <label for="password" class="required"> ContraseГ±a </label> <input type="password" name="password" id="password" value="" class="txt form-control" placeholder="ContraseГ±a"> </li> </ul> <p> <button id="submit_login" class="orangeBtn allRounded biggerBtn btn btn-primary" type="submit"> <span>Ingresar</span> </button> <a class="dont" href="/inscribirse/" onclick="_gaq.push(['pgt._trackEvent', 'Signup', 'SignupClicks', 'SignupLogin']);">ВїNo tienes una cuenta? RegГ*strate</a> </p> <p class="forgotLink"> <a title="ВїOlvidaste tu contraseГ±a o nombre de usuario?" href="/forgot.php" id="linkLoginPageToForgot"> <small>ВїOlvidaste tu contraseГ±a o nombre de usuario?</small> </a> </p> </form> </div> </div> <div class="col-sm-4" id="bottom"> <hr class="hidden-sm hidden-md hidden-lg" /> <p class="hidden-sm hidden-md hidden-lg">O ingresa con</p> <div class="socialPadding hidden-xs"></div> <div class="social"> <a class="btn socialBtn oauth-btn facebook" id="#" href="/user/oauth?provider=facebook"> <i class="icon icon_facebook icon_facebook_plus"></i> <span class="hidden-xs">Ingresar con Facebook</span> </a> <a class="btn socialBtn oauth-btn twitter" id="#" href="/user/oauth?provider=twitter"> <i class="icon icon_twitter icon_twitter_plus"></i> <span class="hidden-xs">Ingresar con Twitter</span> </a> <a class="btn socialBtn oauth-btn google" id="#" href="/user/oauth?provider=google"> <i class="icon icon_google icon_google_plus"></i> <span class="hidden-xs">Ingresar con Google</span> </a> <p class="small">Si no tienes una cuenta con nosotros, te crearemos una. Al crear una cuenta usando tu cuenta de Facebook, Twitter o Google, aceptas nuestros <a href="/terms.php" target="blank" id="linkLoginPageToTerms">TГ©rminos de uso</a> y <a href="/privacy.php" target="blank" id="linkLoginPageToPrivacy">PolГ*tica de privacidad</a>. <p> </div> </div> </div> </div> </div> </div> </div> <div class="visible-xs text-center"> </div> <div class="footer"> <div class="copyright"> ©2017 BuenasTareas.com <a title="Legal (actualizado 9/9/14)" href="/legal.php"> Legal (actualizado 9/9/14) </a> <a title="Mapa del sitio" href="/sitemap.html"> Mapa del sitio </a> <span class="replace comscore"></span> </div> </div> <div id="js-tpl-var-container" style="display:none;">{"essaysImgCdnUrl":"\/\/images-study.netdna-ssl.com\/pi\/","useDefaultThumbs":true,"defaultThumbImgs":["\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_4.png","\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_2.png","\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_3.png","\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_4.png","\/\/bts-study.netdna-ssl.com\/stm\/images\/placeholders\/default_paper_5.png"],"thumb_default_size":"160x220","thumb_ac_size":"80x110","isPayOrJoin":false,"essayUpload":true,"site_id":2,"autoComplete":false,"isPremiumCountry":false,"userCountryCode":"UA","logPixelPath":"\/\/www.smhpix.com\/pixel.gif","tracking_url":"\/\/www.smhpix.com\/pixel.gif","cookies":{"unlimitedBanner":"off"},"analytics":{"googleId":"UA-18439344-1"}}</div><!-- global JS --> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/labjs/2.0.3/LAB.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.runtime.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.payment/1.3.2/jquery.payment.min.js"></script> <script type="text/javascript" src="//bts-study.netdna-ssl.com/5862def78c03/_assets/bts/98df4d96188603cdd46db56a0a4282d4.js"></script> <script type="text/javascript"> window.SM2_DEFER = true; function downloadJSAtOnload() { $LAB .script("//bts-study.netdna-ssl.com/5862def78c03/_assets/bts/509b59653c4482cf9d360f89d35c0826.js") .wait(function() { }); } // Check for browser support of event handling capability if (window.addEventListener) window.addEventListener("load", downloadJSAtOnload, false); else if (window.attachEvent) window.attachEvent("onload", downloadJSAtOnload); else window.onload = downloadJSAtOnload; </script> <script type="text/javascript"> var _comscore = _comscore || []; _comscore.push( { c1: "2", c2: "8909260" }); (function() { var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true; s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js"; el.parentNode.insertBefore(s, el); })(); </script> <noscript> <img src="http://b.scorecardresearch.com/p?c1=2&c2=8909260&cv=2.0&cj=1" alt='' /> </noscript><script type="text/javascript"> _qevents.push( { qacct:"p-640Vrv-0V_6l-"} ); </script> <noscript> <div style="display: none;"><img src="//pixel.quantserve.com/pixel/p-640Vrv-0V_6l-.gif" height="1" width="1" alt="Quantcast" /></div> </noscript><!--[if lte IE 8]> <script src="//bts-study.netdna-ssl.com/stm/js/respond.js"></script> <link href="//bts-study.netdna-ssl.com/stm/proxy/respond-proxy.html" id="respond-proxy" rel="respond-proxy" /> <link href="/stm/proxy/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" /> <script src="//bts-study.netdna-ssl.com/stm/proxy/respond.proxy.js"></script> <![endif]--> </body> </html>
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д