1. <legend id='VU5ll'><style id='VU5ll'><dir id='VU5ll'><q id='VU5ll'></q></dir></style></legend>
        <i id='VU5ll'><tr id='VU5ll'><dt id='VU5ll'><q id='VU5ll'><span id='VU5ll'><b id='VU5ll'><form id='VU5ll'><ins id='VU5ll'></ins><ul id='VU5ll'></ul><sub id='VU5ll'></sub></form><legend id='VU5ll'></legend><bdo id='VU5ll'><pre id='VU5ll'><center id='VU5ll'></center></pre></bdo></b><th id='VU5ll'></th></span></q></dt></tr></i><div id='VU5ll'><tfoot id='VU5ll'></tfoot><dl id='VU5ll'><fieldset id='VU5ll'></fieldset></dl></div>
        • <bdo id='VU5ll'></bdo><ul id='VU5ll'></ul>

      2. <tfoot id='VU5ll'></tfoot>

        <small id='VU5ll'></small><noframes id='VU5ll'>

      3. 如何防止 WebClient 类自动跟随标头中的位置?

        时间:2023-08-26
        • <tfoot id='fZpls'></tfoot>

            <bdo id='fZpls'></bdo><ul id='fZpls'></ul>

            • <small id='fZpls'></small><noframes id='fZpls'>

              <i id='fZpls'><tr id='fZpls'><dt id='fZpls'><q id='fZpls'><span id='fZpls'><b id='fZpls'><form id='fZpls'><ins id='fZpls'></ins><ul id='fZpls'></ul><sub id='fZpls'></sub></form><legend id='fZpls'></legend><bdo id='fZpls'><pre id='fZpls'><center id='fZpls'></center></pre></bdo></b><th id='fZpls'></th></span></q></dt></tr></i><div id='fZpls'><tfoot id='fZpls'></tfoot><dl id='fZpls'><fieldset id='fZpls'></fieldset></dl></div>
            • <legend id='fZpls'><style id='fZpls'><dir id='fZpls'><q id='fZpls'></q></dir></style></legend>

                  <tbody id='fZpls'></tbody>
                  本文介绍了如何防止 WebClient 类自动跟随标头中的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 WebClient 类上可以吗?

                  Is it possible on the WebClient class?

                  例如类似:

                  MyWebClient.AllowAutoRedirect = false; (of HttpWebRequest) 
                  

                  推荐答案

                  您可以编写一个自定义 Web 客户端并启用此功能:

                  You could write a custom web client and enable this functionality:

                  public class WebClientEx : WebClient
                  {
                      protected override WebRequest GetWebRequest(Uri address)
                      {
                          var request = (HttpWebRequest)base.GetWebRequest(address);
                          request.AllowAutoRedirect = false;
                          return request;
                      }
                  }
                  

                  然后:

                  using (var client = new WebClientEx())
                  {
                      Console.WriteLine(client.DownloadString("http://google.com"));
                  }
                  

                  这篇关于如何防止 WebClient 类自动跟随标头中的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:ASP.NET 中的缓存控制标头 下一篇:ASP.NET 母版页:如何在 aspx 内的 head 部分插入标记

                  相关文章

                  最新文章

                1. <tfoot id='ziiCY'></tfoot>

                    <small id='ziiCY'></small><noframes id='ziiCY'>

                      <i id='ziiCY'><tr id='ziiCY'><dt id='ziiCY'><q id='ziiCY'><span id='ziiCY'><b id='ziiCY'><form id='ziiCY'><ins id='ziiCY'></ins><ul id='ziiCY'></ul><sub id='ziiCY'></sub></form><legend id='ziiCY'></legend><bdo id='ziiCY'><pre id='ziiCY'><center id='ziiCY'></center></pre></bdo></b><th id='ziiCY'></th></span></q></dt></tr></i><div id='ziiCY'><tfoot id='ziiCY'></tfoot><dl id='ziiCY'><fieldset id='ziiCY'></fieldset></dl></div>
                      <legend id='ziiCY'><style id='ziiCY'><dir id='ziiCY'><q id='ziiCY'></q></dir></style></legend>
                        <bdo id='ziiCY'></bdo><ul id='ziiCY'></ul>