Click here to Skip to main content
15,881,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
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
               });

           }
Posted
Updated 9-Nov-11 17:36pm
v2

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.
 
Share this answer
 
v3
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900