aspx Tutorial

NET Articles,jQuery demo, with jQuery, online tutorial,Jquery, SilverLight, Javascript,,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here


Get our toolbar!


Posted by Aamir Hasan   on Tuesday, April 5, 2011 Total Views:  

I have noticed that many developers have problems when they face “407 Proxy Authentication Required” exception on the internet by application. Your application required proxy server when you use your application behind the LAN.

In net 1.1 GlobalProxySelection class allows you to return WebRequest.DefaultWebProxy.

You can also prompt the user for the own credential, or you can also set the default credentials. I will also advice you that don’t set credentials until you will not receive 407 exception message.

There are some other examples but at the time this will helps you. Next time I will publish some more examples on this error, if you have more concerned please feel free to ask.


        System.Net.WebRequest request = System.Net

        System.Net.WebProxy pry = new System.Net.WebProxy("PROXY ADDRESS", 8080);

        pry.Credentials = System.Net.CredentialCache.DefaultCredentials;

        System.Net.GlobalProxySelection.Select = pry;


        System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();

        System.IO.Stream dataStream = response.GetResponseStream();

        System.IO.StreamReader reader = new System.IO.StreamReader(dataStream);

         string responseFromServer = reader.ReadToEnd();





Protected by Copyscape Online Plagiarism Tool

Add comment

  Country flag

  • Comment
  • Preview

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5