WebRequest.Create() in System.Net; 
Author Message
 WebRequest.Create() in System.Net;

My code is given below IN THE END.

When i try to access the webpage i get the error as "The remote server
returned an error : (407) Proxy Authentication required."

I am on a network using OS as winnt 4.0 and i do have rights to access
the internet (although i have to enter details in 'Tools->Internet
options->Connection->Lan Setting->proxy server'

CODE
=====
try
{
......
WebRequest WReq=WebRequest.Create(" http://www.*-*-*.com/ ");
WebResponse WResp = WReq.GetResponse();
      // get the stream of data
StreamReader sr = new

StreamReader(WResp.GetResponseStream(),Encoding.ASCII);
       string strTemp = "";
        while ((strTemp = sr.ReadLine()) != null)
        {
              System.Console.WriteLine(strTemp + "\r\n");
System.Console.WriteLine("Code written");
        }
.....
====



Sun, 15 May 2005 21:09:24 GMT  
 WebRequest.Create() in System.Net;
Ashish,

    If you need to enter information in IE to access the internet, then you
need to duplicate the information on the WebRequest (through the
WebRequest.Proxy property).  The WebRequest class does not take the
information from IE's settings to set the proxy.

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> My code is given below IN THE END.

> When i try to access the webpage i get the error as "The remote server
> returned an error : (407) Proxy Authentication required."

> I am on a network using OS as winnt 4.0 and i do have rights to access
> the internet (although i have to enter details in 'Tools->Internet
> options->Connection->Lan Setting->proxy server'

> CODE
> =====
> try
> {
> ......
> WebRequest WReq=WebRequest.Create("http://www.amtel-security.com");
> WebResponse WResp = WReq.GetResponse();
>       // get the stream of data
> StreamReader sr = new

> StreamReader(WResp.GetResponseStream(),Encoding.ASCII);
>        string strTemp = "";
>         while ((strTemp = sr.ReadLine()) != null)
>         {
>               System.Console.WriteLine(strTemp + "\r\n");
> System.Console.WriteLine("Code written");
>         }
> .....
> ====



Sun, 15 May 2005 21:33:07 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How do I use System.Net.WebRequest?

2. Is WebRequest.Create() and WebRequestFactory.Create() same ??????

3. Using .NET webrequest w/xml post

4. WebRequest.Create() not available in C# ?

5. Unhandled Exception: System.Configuration.ConfigurationException: Could not create System Configuration.NameValueSectionHandler, System

6. ANN: Accelent Systems chat: File System Architecture in Windows CE .NET

7. When to use System.Net and System.Runtime.Remoting

8. how to use System.Net in Visual Studio.Net 7.0

9. .NET project locking/loading DLL created by other .NET project

10. .NET project locking/loading DLL created by other .NET project

11. WebRequest/WebResponse question?

12. Progress indicator for async WebRequest operations?

 

 
Powered by phpBB® Forum Software