C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Detect network settings in a web page


Posted Date: 26 Apr 2007    Resource Type: Code Snippets    Category: Console Applications

Posted By: Srini Sistla       Member Level: Silver
Rating:     Points: 10



This code tells you programmatically how to find out the existing LAN settings under IE. Incase a proxy pac is used, it shall find out the routing IP address and the port and tells you.



private static void QueryIEProxySettings()
{
string strFileURL = "www.hotmail.com";

HttpWebRequest WebReqt = (HttpWebRequest)HttpWebRequest.Create(strFileURL);

WebProxy WP = new WebProxy(WebReqt.Proxy.GetProxy(new Uri(strFileURL)));

WP.Credentials = CredentialCache.DefaultCredentials;

Console.WriteLine(WP.Address);

// or use the Below...

//CheckForProxy(new Uri("http://www.hotmail.com"));
}

private static void CheckForProxy(Uri resource)
{
WebProxy proxy = (WebProxy)WebProxy.GetDefaultProxy();

Uri proxyUri = proxy.GetProxy(resource);

if (proxyUri == resource)
{
Console.WriteLine("No proxy for {0}", resource);
}
else
{
Console.WriteLine("Proxy for {0} is {1}", resource, proxyUri.ToString());
}

}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Quick Console Utility to hide itself and do activities in the background
Previous Resource: Detect keystrockes in C#
Return to Discussion Resource Index
Post New Resource
Category: Console Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

UK Conference calling Company

Contact Us    Privacy Policy    Terms Of Use