I am getting a The remote server returned an error: (407) Proxy Authentication Required.
error from a call to the web, and I believe I need to put the details of my proxy server into my web.config file.
I've tried to do this by the following but to no avail, how am I doing it wrong please?
Surely it is your browser that needs to be updated with proxy server details?
Click "Mark as Answer" on the post that helped you.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
There is one KB article with the same symptoms as you have described. pls look at :http://support.microsoft.com/kb/315909 for more detiled information. BTW,it gives an cause description with a resolution
within it, so, i think it will be helpful :)
If you have further questiones, feel free to let we know. thanks.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Sorry to ask, but when I put the line "WebProxy p =new WebProxy("address", port);"
I get the error "WebProxy is a type and cannot be used in an expression".
public static WebProxy CreateProxyWithHostAndPort()
{
return new WebProxy("http://contoso", 80);
}
although I'm not sure how I add credentials to my new Webproxy object like in this thread (http://forums.asp.net/thread/1605426.aspx) [:$] so far I have the below:
proxyObject = new System.Net.WebProxy("http://myDomain:8080/", true);
System.Net.WebRequest req = System.Net.WebRequest.Create(http://www.website.com/);
req.Proxy = proxyObject;
proxyObject.Credentials = New System.Net.NetworkCredential("domain\username","password")
xtr = new XmlTextReader(http://www.website.com/);
stokefan_98
Member
349 Points
99 Posts
Specifying proxy server in web.config
May 04, 2007 01:37 PM|LINK
Hi all,
I am getting a The remote server returned an error: (407) Proxy Authentication Required. error from a call to the web, and I believe I need to put the details of my proxy server into my web.config file.
I've tried to do this by the following but to no avail, how am I doing it wrong please?
<defaultProxy> <proxy proxyaddress ="http://contoso:8080" bypassonlocal="True" usesystemdefault="False" /> </defaultProxy>TATWORTH
All-Star
72415 Points
14017 Posts
MVP
Re: Specifying proxy server in web.config
May 04, 2007 01:48 PM|LINK
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
stokefan_98
Member
349 Points
99 Posts
Re: Specifying proxy server in web.config
May 04, 2007 01:57 PM|LINK
no its not the browser, that's configured correctly.
objWebResponse = CType(objWebRequest.GetResponse(), System.Net.HttpWebResponse)
is the line which my app is faltering at.
Bo Chen – MS...
All-Star
17706 Points
1389 Posts
Re: Specifying proxy server in web.config
May 07, 2007 07:30 AM|LINK
Hi stokefan,
There is one KB article with the same symptoms as you have described. pls look at :http://support.microsoft.com/kb/315909 for more detiled information. BTW,it gives an cause description with a resolution within it, so, i think it will be helpful :)
If you have further questiones, feel free to let we know. thanks.
Jerome Cui -...
Star
12018 Points
1080 Posts
Re: Specifying proxy server in web.config
May 07, 2007 08:52 AM|LINK
Hi,
IMO, use the System.Net.WebProxy object to pass credentials to a proxy server. A sample is below:
Or
Good luck!
Please "mark as answer" if it's useful for you
Sincerely,
Jerome
stokefan_98
Member
349 Points
99 Posts
Re: Specifying proxy server in web.config
May 07, 2007 09:57 AM|LINK
hi,
thanks, i'll try that. Do you need to import/include anything to be able to use the Webproxy item?
thanks.
Jerome Cui -...
Star
12018 Points
1080 Posts
Re: Specifying proxy server in web.config
May 07, 2007 10:04 AM|LINK
Remember to import System.Net namespace;
Good luck!
Please "mark as answer" if it's useful for you
Sincerely,
Jerome
stokefan_98
Member
349 Points
99 Posts
Re: Specifying proxy server in web.config
May 08, 2007 08:28 AM|LINK
Sorry to ask, but when I put the line "WebProxy p =new WebProxy("address", port);" I get the error "WebProxy is a type and cannot be used in an expression".
Any ideas please?
thanks.
Jerome Cui -...
Star
12018 Points
1080 Posts
Re: Specifying proxy server in web.config
May 08, 2007 08:37 AM|LINK
It should be like below:
public static WebProxy CreateProxyWithHostAndPort()
{
return new WebProxy("http://contoso", 80);
}
More details:
WebProxy.WebProxy(String, Int32) Constructor
http://msdn2.microsoft.com/en-us/library/xfsh37cx.aspx
Good luck!
Please "mark as answer" if it's useful for you
Sincerely,
Jerome
stokefan_98
Member
349 Points
99 Posts
Re: Specifying proxy server in web.config
May 11, 2007 09:51 AM|LINK
Thanks. I'm using VB.net so I have
public static WebProxy CreateProxyWithHostAndPort() { return new WebProxy("http://contoso", 80); }although I'm not sure how I add credentials to my new Webproxy object like in this thread (http://forums.asp.net/thread/1605426.aspx) [:$] so far I have the below: