Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0.
This problem can be shown when trying to access a WebService using SSL and
through a proxy server after using the HttpWebRequest object.
Under normal circumstances I am able to use the webservice without any
problems. But after using an HttpWebRequest object to make a call to a
website
all subsequent attempts to use the WebService will fail with a 401
Unauthorized error. This problem appears to be directly related to when the
Client's Internet Explorer settings are configured to use a Proxy server for
http requests. If the settings for the proxy server are disabled everything
works as expected.
Server Configuration:
Windows 2003 Server Service Pack 2
IIS 6.0, Using SSL Port 443, Anonymous access disabled, using Integrated
Windows Authentication
..Net 2.0
Client:
Windows XP Service Pack 2
..Net 2.0
IE 7, configured to use a proxy server
Below is sample code that can be used to reproduce the problem with a CSharp
Windows Application.
//PreRequisites: Webservice must be using SSL (https) and does
not allow anoymous connections(usi ng Integrated Windows Authentication)
//Client's IE Settings requires http requests to go through a
Proxy server. (If proxy is not enabled the below scenario works properly)
//Create Web Service Object
YourWebService webServiceObjec t = new YourWebService( );
//Set Credentials for Web Service
webServiceObjec t.Credentials = new
System.Net.Netw orkCredential(" username", "password", "domain");
//Call a method from the Web Service. This Call works without
any errors.
object returnObject = webServiceObjec t.anyWebService Method();
//Create HttpWebRequest Object to any non secure web page
HttpWebRequest webRequestObjec t =
(HttpWebRequest )HttpWebRequest .Create("http://www.microsoft.c om/");
//Call GetResponse
HttpWebResponse testRes =
(HttpWebRespons e)webRequestObj ect.GetResponse ();
//Call the same method from the Same Web Service Object. This
call will fail.
returnObject = webServiceObjec t.anyWebService Method();
//The Above call will fail with the following error
//"The request failed with HTTP status 401: Unauthorized."
//Sample Stack Trace of the error
//at
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.ReadRes ponse(SoapClien tMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
//at
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.Invoke( String
methodName, Object[] parameters)
//at Proxy.[snip].Service.Valida teAccount(Strin g email, String
password, OperatingSystem Info osInfo) in
C:\Projects\San dbox\CSharp\Pro xyTest\Web References\[snip]\Reference.cs:l ine
336
//at Proxy.Form1.For m1_Load(Object sender, EventArgs e) in
C:\Projects\San dbox\CSharp\Pro xyTest\Form1.cs :line 38
//at System.Windows. Forms.Form.OnLo ad(EventArgs e)
//at System.Windows. Forms.Form.OnCr eateControl()
//at System.Windows. Forms.Control.C reateControl(Bo olean
fIgnoreVisible)
//at System.Windows. Forms.Control.C reateControl()
//at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
//at System.Windows. Forms.Control.W ndProc(Message& m)
//at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
//at System.Windows. Forms.Container Control.WndProc (Message& m)
//at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
//at System.Windows. Forms.Form.WndP roc(Message& m)
//at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
//at
System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
//at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
//at System.Windows. Forms.SafeNativ eMethods.ShowWi ndow(HandleRef
hWnd, Int32 nCmdShow)
//at System.Windows. Forms.Control.S etVisibleCore(B oolean value)
//at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
//at System.Windows. Forms.Control.s et_Visible(Bool ean value)
//at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
//at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
//at System.Windows. Forms.Applicati on.Run(Form mainForm)
//at Proxy.Program.M ain() in
C:\Projects\San dbox\CSharp\Pro xy\Proxy\Progra m.cs:line 17
//at System.AppDomai n.nExecuteAssem bly(Assembly assembly,
String[] args)
//at System.AppDomai n.ExecuteAssemb ly(String assemblyFile,
Evidence assemblySecurit y, String[] args)
//at
Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
//at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object
state)
//at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
//at System.Threadin g.ThreadHelper. ThreadStart()
Please do not hesitate to contact me if you require any additional
information or if you have a solution.
--
Larry Kuperman
Global Account Manager
Stardock- A Microsoft Gold Partner 2 3472
iy looks like the proxy requires authenication (pretty much standard). you
should supply proxy credentials to the webrequest.
-- bruce (sqlwork.com)
"LarryKuper man" wrote:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0.
This problem can be shown when trying to access a WebService using SSL and
through a proxy server after using the HttpWebRequest object.
Under normal circumstances I am able to use the webservice without any
problems. But after using an HttpWebRequest object to make a call to a
website
all subsequent attempts to use the WebService will fail with a 401
Unauthorized error. This problem appears to be directly related to when the
Client's Internet Explorer settings are configured to use a Proxy server for
http requests. If the settings for the proxy server are disabled everything
works as expected.
Server Configuration:
Windows 2003 Server Service Pack 2
IIS 6.0, Using SSL Port 443, Anonymous access disabled, using Integrated
Windows Authentication
.Net 2.0
Client:
Windows XP Service Pack 2
.Net 2.0
IE 7, configured to use a proxy server
Below is sample code that can be used to reproduce the problem with a CSharp
Windows Application.
//PreRequisites: Webservice must be using SSL (https) and does
not allow anoymous connections(usi ng Integrated Windows Authentication)
//Client's IE Settings requires http requests to go through a
Proxy server. (If proxy is not enabled the below scenario works properly)
//Create Web Service Object
YourWebService webServiceObjec t = new YourWebService( );
//Set Credentials for Web Service
webServiceObjec t.Credentials = new
System.Net.Netw orkCredential(" username", "password", "domain");
//Call a method from the Web Service. This Call works without
any errors.
object returnObject = webServiceObjec t.anyWebService Method();
//Create HttpWebRequest Object to any non secure web page
HttpWebRequest webRequestObjec t =
(HttpWebRequest )HttpWebRequest .Create("http://www.microsoft.c om/");
//Call GetResponse
HttpWebResponse testRes =
(HttpWebRespons e)webRequestObj ect.GetResponse ();
//Call the same method from the Same Web Service Object. This
call will fail.
returnObject = webServiceObjec t.anyWebService Method();
//The Above call will fail with the following error
//"The request failed with HTTP status 401: Unauthorized."
//Sample Stack Trace of the error
//at
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.ReadRes ponse(SoapClien tMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
//at
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.Invoke( String
methodName, Object[] parameters)
//at Proxy.[snip].Service.Valida teAccount(Strin g email, String
password, OperatingSystem Info osInfo) in
C:\Projects\San dbox\CSharp\Pro xyTest\Web References\[snip]\Reference.cs:l ine
336
//at Proxy.Form1.For m1_Load(Object sender, EventArgs e) in
C:\Projects\San dbox\CSharp\Pro xyTest\Form1.cs :line 38
//at System.Windows. Forms.Form.OnLo ad(EventArgs e)
//at System.Windows. Forms.Form.OnCr eateControl()
//at System.Windows. Forms.Control.C reateControl(Bo olean
fIgnoreVisible)
//at System.Windows. Forms.Control.C reateControl()
//at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
//at System.Windows. Forms.Control.W ndProc(Message& m)
//at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
//at System.Windows. Forms.Container Control.WndProc (Message& m)
//at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
//at System.Windows. Forms.Form.WndP roc(Message& m)
//at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
//at
System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
//at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
//at System.Windows. Forms.SafeNativ eMethods.ShowWi ndow(HandleRef
hWnd, Int32 nCmdShow)
//at System.Windows. Forms.Control.S etVisibleCore(B oolean value)
//at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
//at System.Windows. Forms.Control.s et_Visible(Bool ean value)
//at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
//at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
//at System.Windows. Forms.Applicati on.Run(Form mainForm)
//at Proxy.Program.M ain() in
C:\Projects\San dbox\CSharp\Pro xy\Proxy\Progra m.cs:line 17
//at System.AppDomai n.nExecuteAssem bly(Assembly assembly,
String[] args)
//at System.AppDomai n.ExecuteAssemb ly(String assemblyFile,
Evidence assemblySecurit y, String[] args)
//at
Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
//at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object
state)
//at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
//at System.Threadin g.ThreadHelper. ThreadStart()
Please do not hesitate to contact me if you require any additional
information or if you have a solution.
--
Larry Kuperman
Global Account Manager
Stardock- A Microsoft Gold Partner
Hi, Bruce and thanks for your reply. We are using this as a workaround, but
it doesn't really solve the issue.
Under normal circumstances we are able to use the webservice without any
problems. But after using an HttpWebRequest object to make a call to a
website
all subsequent attempts to use the WebService will fail with a 401
Unauthorized error.
So, initially the .Net framework is setting the proxy for you. But after
using a WebRequest the Proxy settings for the WebService calls get removed
and thus need to be set manually.
We are still seeking a solution.
--
Larry Kuperman
Global Account Manager
Stardock- A Microsoft Gold Partner
"bruce barker" wrote:
iy looks like the proxy requires authenication (pretty much standard). you
should supply proxy credentials to the webrequest.
-- bruce (sqlwork.com)
"LarryKuper man" wrote:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0.
This problem can be shown when trying to access a WebService using SSL and
through a proxy server after using the HttpWebRequest object.
Under normal circumstances I am able to use the webservice without any
problems. But after using an HttpWebRequest object to make a call to a
website
all subsequent attempts to use the WebService will fail with a 401
Unauthorized error. This problem appears to be directly related to when the
Client's Internet Explorer settings are configured to use a Proxy server for
http requests. If the settings for the proxy server are disabled everything
works as expected.
Server Configuration:
Windows 2003 Server Service Pack 2
IIS 6.0, Using SSL Port 443, Anonymous access disabled, using Integrated
Windows Authentication
.Net 2.0
Client:
Windows XP Service Pack 2
.Net 2.0
IE 7, configured to use a proxy server
Below is sample code that can be used to reproduce the problem with a CSharp
Windows Application.
//PreRequisites: Webservice must be using SSL (https) and does
not allow anoymous connections(usi ng Integrated Windows Authentication)
//Client's IE Settings requires http requests to go through a
Proxy server. (If proxy is not enabled the below scenario works properly)
//Create Web Service Object
YourWebService webServiceObjec t = new YourWebService( );
//Set Credentials for Web Service
webServiceObjec t.Credentials = new
System.Net.Netw orkCredential(" username", "password", "domain");
//Call a method from the Web Service. This Call works without
any errors.
object returnObject = webServiceObjec t.anyWebService Method();
//Create HttpWebRequest Object to any non secure web page
HttpWebRequest webRequestObjec t =
(HttpWebRequest )HttpWebRequest .Create("http://www.microsoft.c om/");
//Call GetResponse
HttpWebResponse testRes =
(HttpWebRespons e)webRequestObj ect.GetResponse ();
//Call the same method from the Same Web Service Object. This
call will fail.
returnObject = webServiceObjec t.anyWebService Method();
//The Above call will fail with the following error
//"The request failed with HTTP status 401: Unauthorized."
//Sample Stack Trace of the error
//at
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.ReadRes ponse(SoapClien tMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
//at
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.Invoke( String
methodName, Object[] parameters)
//at Proxy.[snip].Service.Valida teAccount(Strin g email, String
password, OperatingSystem Info osInfo) in
C:\Projects\San dbox\CSharp\Pro xyTest\Web References\[snip]\Reference.cs:l ine
336
//at Proxy.Form1.For m1_Load(Object sender, EventArgs e) in
C:\Projects\San dbox\CSharp\Pro xyTest\Form1.cs :line 38
//at System.Windows. Forms.Form.OnLo ad(EventArgs e)
//at System.Windows. Forms.Form.OnCr eateControl()
//at System.Windows. Forms.Control.C reateControl(Bo olean
fIgnoreVisible)
//at System.Windows. Forms.Control.C reateControl()
//at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
//at System.Windows. Forms.Control.W ndProc(Message& m)
//at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
//at System.Windows. Forms.Container Control.WndProc (Message& m)
//at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
//at System.Windows. Forms.Form.WndP roc(Message& m)
//at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
//at
System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
//at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
//at System.Windows. Forms.SafeNativ eMethods.ShowWi ndow(HandleRef
hWnd, Int32 nCmdShow)
//at System.Windows. Forms.Control.S etVisibleCore(B oolean value)
//at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
//at System.Windows. Forms.Control.s et_Visible(Bool ean value)
//at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
//at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
//at System.Windows. Forms.Applicati on.Run(Form mainForm)
//at Proxy.Program.M ain() in
C:\Projects\San dbox\CSharp\Pro xy\Proxy\Progra m.cs:line 17
//at System.AppDomai n.nExecuteAssem bly(Assembly assembly,
String[] args)
//at System.AppDomai n.ExecuteAssemb ly(String assemblyFile,
Evidence assemblySecurit y, String[] args)
//at
Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
//at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object
state)
//at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
//at System.Threadin g.ThreadHelper. ThreadStart()
Please do not hesitate to contact me if you require any additional
information or if you have a solution.
--
Larry Kuperman
Global Account Manager
Stardock- A Microsoft Gold Partner
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: bd-chan |
last post by:
I'm trying to log in to a secured web site automatically using c#. To
do this I have go through a proxy server, and use SSL, and log in to
the secure site with another user name and password (different from the
proxy user name and password).
Now, I can get through the proxy by setting the correct credentials on
the WebProxy. I can get...
|
by: Imran Aziz |
last post by:
Hello All,
I am using HttpWebRequest to fetch webpages in my ASP.net C#
application. The request works fine without the proxy, but on using the code
from within a network that uses proxy the request does not work. I tried to
use the MS code to get around it, but having problems using it. The first
thing is that the this conversion
...
|
by: MSDNAndi |
last post by:
Hi,
I have a set of simple webservices calls that worked fine using .NET
Framework 1.0.
I am calling a Java/Apache based webservices, the calling side is not able
to supply a proper WSDL.
What it does is to call a webservice with two parameters, one being a
integer, the other one being a "String" which contains XML (not the best...
|
by: sameer |
last post by:
..NET Framework 1.1
VS2003
Application is making webservice calls from behind a proxy server and then
freezes and dies.
Questoin is can i use webservice over proxy server( i guess another name of
them is ISA ... if i a not wrong), if yes how?
Sameer
|
by: hharry |
last post by:
hello all,
trying to consume a simple web service using httpwebrequest instead of
generating a proxy class.
code for simple web service:
Imports System.Web.Services
<System.Web.Services.WebService(Namespace :=
| |
by: dan kisting |
last post by:
Hello,
I am writing a c# application which connects to web services through a
Proxy Server. I am running a local Proxy Host to simulate what the
user is seeing, and his problem is he is getting a 407 error, Proxy
Authentication Required. I am applying the credentials and I realize I
am probably just missing something. Here is my code, do...
|
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= |
last post by:
Our WebDev team is experiencing a problem when trying to access a WebService
using SSL and through a proxy server after using the HttpWebRequest object.
Under normal circumstances we are able to use the webservice without any
problems. But after using an HttpWebRequest object to make a call to a
website
all subsequent attempts to use the...
|
by: =?Utf-8?B?TGVuc3Rlcg==?= |
last post by:
A C# (.NET 2) application which uses the System.Net.HttpWebRequest object to
request a resource over HTTPS is failing following the installation of a new
proxy server on our internal network with 407 Proxy Authentication Required.
The same request through the old proxy succeeds.
The same request to an HTTP address through the new proxy...
|
by: |
last post by:
Hi all,
I have an asp.net 2.0 website that accesses a locally hosted web service.
This works fine on servers that are connected to our network. However, I am
having a problem with a laptop server that I have built. The code that tries
to connect to the web service breaks if the laptop is not within our
network. Further debugging has...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |