您可以使用HttpWebRequest访问具有防火墙的站点吗? [英] Can you access a site which has firewall using HttpWebRequest?

查看:123
本文介绍了您可以使用HttpWebRequest访问具有防火墙的站点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于安全原因,是否可以访问设置了防火墙的站点.
我的客户站点具有防火墙设置,因此我可以使用httpwebrequest访问该站点吗?
我可以在下面使用此代码吗?

Is it possible to access a site which has firewall set for security reasons.
my client site has firewall settings,so can i use httpwebrequest to access the site
can i use this code below:

try
           {
               Uri uri = new Uri("http://" + _host);

               WebRequest http = HttpWebRequest.Create(uri);
               http.Credentials = new NetworkCredential(_login, _password);
               http.PreAuthenticate = true;

              _httpWebResponse = (HttpWebResponse)http.GetResponse();

               _scs = ServerConnectionStatus.Connected;
               result = true;
           }
           catch (UriFormatException e)
           {
               EventLog.Instance.AppendText(null, new LogEntryEventArgs()
               {
                   Status = LogEventStatus.Error,
                   Text = "HTTPServerCommunication: " + e.Message
               });

           }

推荐答案

与SA的答案相吻合(全面).由于与防火墙有关,因此您首先要检查它是什么?
http://en.wikipedia.org/wiki/Firewall_(计算)

系统管理员可以使用防火墙设置多个过滤器/限制,但这是为了防止其域网络受到诸如黑客入侵/数据泄露等安全威胁.

如果系统管理员希望他们可以阻止所有站点,那么问题是为什么要拥有Internet?常规的HTTP和HTTPs站点大部分不会被阻止.

只需从浏览器访问您的站点进行检查,如果它可以访问,那么您的HttpWebRequest也可以访问它.
Contuning to SA''s Answer(which is comprehensive). As your concern is with Firewall then you first check what is it?
http://en.wikipedia.org/wiki/Firewall_(computing)

System Administrators can set multiple filters/restrictions using Firewall, But it''s purpose is to prevent their Domain Network from security threats like hacking/data breaching etc.

If System Administrators wants they can block ALL the sites, But then question is why to have Internet? Regular HTTP and HTTPs sites are mostly does not blocked.

Simply check by accessing your site from Browser, if it is accessible then it will be accessible by your HttpWebRequest as well.


如果防火墙阻止了HTTP或HTTPS,问题是:什么?允许吗? :-)

除病理情况外,正常情况下经过调整的防火墙对HTTP应该是完全透明的,因此,如果Web应用程序代码和Web请求代码均正确编写,则所有基于HttpWebRequest的代码都应正常工作.

—SA
If a firewall blocks HTTP or HTTPS, the question is: what does it allow? :-)

Except for pathological cases, normally tuned firewall should be totally transparent to HTTP, so all your code based on HttpWebRequest should work, if both Web application code and your Web request code are written correctly.

—SA


这篇关于您可以使用HttpWebRequest访问具有防火墙的站点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆