aspx Tutorial

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

Toolbar

Get our toolbar!

Advertize



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.

Example

        System.Net.WebRequest request = System.Net
                             .WebRequest.Create("http://www.aspxtutorial.com/Default.aspx");

        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();

        Response.Write(responseFromServer);

        reader.Close();

        dataStream.Close();

        response.Close();

Protected by Copyscape Online Plagiarism Tool

Comments (2) -

Gil Keech
Gil Keech United States
6/24/2015 3:31:41 AM #

Another informative post.  I'm finding such great info lately.  How did folks survive before the internet?  Thank you for the work on this!

Andre Miyao
Andre Miyao United States
6/26/2015 11:39:44 AM #

Hi, awesome post.  I'm reading such great ideas today.  What did people do before websites?  Appreciate the work on this!

swimsuit agua bendita
swimsuit agua bendita United States
7/28/2015 12:47:43 PM #

Agua Bendita Plumaje
Agua Bendita Plumaje United States
7/29/2015 5:18:44 AM #

Hey, you used to write great, but the last several posts have been kinda boring… I miss your great writings. Past several posts are just a little bit out of track! come on!

alkaline water ionizers
alkaline water ionizers United States
7/31/2015 2:22:13 AM #

Hi! Ive been reading your website for a while now finally got the bravery to go ahead give you a shout out from Houston Tx! Just wanted to tell you keep up the great job!

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5