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

Myrtice Passarella
Myrtice Passarella United States
8/24/2015 8:34:34 AM #

Monserrate Schanbacher

Ronald Sunstrom
Ronald Sunstrom United States
8/25/2015 3:15:15 PM #

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

Ciera Moog
Ciera Moog United States
8/26/2015 11:12:27 PM #

ok now i get it

free porn
free porn United States
9/1/2015 10:21:29 PM #

If you Want to get off, and Want the Best adult cams to watch doing it, Check Us out!

petite body
petite body United States
9/2/2015 6:16:17 PM #

Vividstream - Really want to make you happy with our Sex Cams, WOW!

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5