473,785 Members | 2,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default credentials

Hello,

I have an application which calls a web service across the
Internet from a client machine.

The site that I have deployed the application to is such that
to browse the Internet using a web browser, a person needs to
do the following:

(a) ensure that a proxy server address is specified;

(b) enter a username and password into an authentication dialog
that comes up whenever they start up the web browser.

I am finding that as a result, I cannot connect at all to the
Internet directly.
I have deployed the same application on other sites that use
a proxy server to connect to the Internet by specifying the
proxy server address in my config file and using this address
to create a proxy for the web service using the following code:

Dim WSProxy as MyWebServicePro xy
WSProxy.Proxy = New WebProxy(proxyS erverAddresss, True, _
Nothing, CredentialCache .DefaultCredent ials)
WSProxy.CallWeb ServiceMethod()

However, this works at client sites where I *don't* have to specify
further authentication before web browsing. In other words, it
*doesn't* work for the client site first mentioned above.
My questions are:

When someone supplies the authentication details when they want
to use the web browser, are those details added to a CredentialCache ?

If so, can I get at this CredentialCache to get these credentials?

If not, should I create my own credentials based on the username,
password and domain that the user normally enters when accessing
the web via a web browser?

TIA,

--
Akin

aknak at aksoto dot idps dot co dot uk

Nov 21 '05 #1
3 13710
If you need to pass certain credentials to your proxy WS class, just use
something like this:

CredentialCache cache = new CredentialCache ();
cache.Add( new Uri( WSProxy.Url ), "Negotiate" , new NetworkCredenti als(
"youruser", "yourpwd", "yourdomain ") );
WSProxy.Credent ials = cache;

If you use NTLM auth in IIS, "Negotiate" will be fine. If you use "Basic"
auth instead, just put "Basic" where it says "negotiate" .
--
Hernan de Lahitte
Lagash Systems S.A.
http://weblogs.asp.net/hernandl
This posting is provided "AS IS" with no warranties, and confers no rights.

"Wild Wind" <no****@blackho le.com> wrote in message
news:2l******** ****@uni-berlin.de...
Hello,

I have an application which calls a web service across the
Internet from a client machine.

The site that I have deployed the application to is such that
to browse the Internet using a web browser, a person needs to
do the following:

(a) ensure that a proxy server address is specified;

(b) enter a username and password into an authentication dialog
that comes up whenever they start up the web browser.

I am finding that as a result, I cannot connect at all to the
Internet directly.
I have deployed the same application on other sites that use
a proxy server to connect to the Internet by specifying the
proxy server address in my config file and using this address
to create a proxy for the web service using the following code:

Dim WSProxy as MyWebServicePro xy
WSProxy.Proxy = New WebProxy(proxyS erverAddresss, True, _
Nothing, CredentialCache .DefaultCredent ials)
WSProxy.CallWeb ServiceMethod()

However, this works at client sites where I *don't* have to specify
further authentication before web browsing. In other words, it
*doesn't* work for the client site first mentioned above.
My questions are:

When someone supplies the authentication details when they want
to use the web browser, are those details added to a CredentialCache ?

If so, can I get at this CredentialCache to get these credentials?

If not, should I create my own credentials based on the username,
password and domain that the user normally enters when accessing
the web via a web browser?

TIA,

--
Akin

aknak at aksoto dot idps dot co dot uk

Nov 21 '05 #2
Hello Hernan,

Thanks for your answer.

Is there a way of knowing whether the dialog box that
comes up on my client site requires NTLM or Basic authentication?

As I said, the dialog comes up whichever site you visit using
a web browser - I assume it must be something they have set up
on their firewall.

Will it matter if I just use "Negotiate" ?

Also, if I add several NetworkCredenti al objects to my cache, and add
this cache to my proxy, will it use all of the credentials in the
cache to authenticate until one succeeds?

Thanks in advance,

Akin

"Hernan de Lahitte" <he****@lagash. com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
If you need to pass certain credentials to your proxy WS class, just use
something like this:

CredentialCache cache = new CredentialCache ();
cache.Add( new Uri( WSProxy.Url ), "Negotiate" , new NetworkCredenti als(
"youruser", "yourpwd", "yourdomain ") );
WSProxy.Credent ials = cache;

If you use NTLM auth in IIS, "Negotiate" will be fine. If you use "Basic"
auth instead, just put "Basic" where it says "negotiate" .
--
Hernan de Lahitte
Lagash Systems S.A.
http://weblogs.asp.net/hernandl
This posting is provided "AS IS" with no warranties, and confers no rights.
"Wild Wind" <no****@blackho le.com> wrote in message
news:2l******** ****@uni-berlin.de...
Hello,

I have an application which calls a web service across the
Internet from a client machine.

The site that I have deployed the application to is such that
to browse the Internet using a web browser, a person needs to
do the following:

(a) ensure that a proxy server address is specified;

(b) enter a username and password into an authentication dialog
that comes up whenever they start up the web browser.

I am finding that as a result, I cannot connect at all to the
Internet directly.
I have deployed the same application on other sites that use
a proxy server to connect to the Internet by specifying the
proxy server address in my config file and using this address
to create a proxy for the web service using the following code:

Dim WSProxy as MyWebServicePro xy
WSProxy.Proxy = New WebProxy(proxyS erverAddresss, True, _
Nothing, CredentialCache .DefaultCredent ials)
WSProxy.CallWeb ServiceMethod()

However, this works at client sites where I *don't* have to specify
further authentication before web browsing. In other words, it
*doesn't* work for the client site first mentioned above.
My questions are:

When someone supplies the authentication details when they want
to use the web browser, are those details added to a CredentialCache ?

If so, can I get at this CredentialCache to get these credentials?

If not, should I create my own credentials based on the username,
password and domain that the user normally enters when accessing
the web via a web browser?

TIA,

--
Akin

aknak at aksoto dot idps dot co dot uk


Nov 21 '05 #3
> Is there a way of knowing whether the dialog box that
comes up on my client site requires NTLM or Basic authentication? When you first try to communicate with your WS server, you will receive a
header with the authentication method required by IIS. There you have a
sample code that will read the auth. header.

try
{
WebRequest wreq = WebRequest.Crea te( new Uri( url ) ); //url is your WS
URL.
WebResponse wresp = wreq.GetRespons e();
wresp.Close();
}
catch( WebException e )
{
if( e.Status == WebExceptionSta tus.ProtocolErr or )
{
string rawMethod = e.Response.Head ers[ "WWW-Authenticate" ];
// rawMethod will has the required authentication method
}
else
{
throw;
}
}
As I said, the dialog comes up whichever site you visit using
a web browser - I assume it must be something they have set up
on their firewall. If your receive a Dialog asking for your creds with NTLM auth (not Basic)
check out your IE configuration
(Tools/Options/Security/[Custom Level] User Authentication (Prompt for user
name and password) option checked.
Will it matter if I just use "Negotiate" ? This will work only for Integrated Windows Authentication method (Negotiate
will switch between Kerberos and NTLM).
Also, if I add several NetworkCredenti al objects to my cache, and add
this cache to my proxy, will it use all of the credentials in the
cache to authenticate until one succeeds? Sure. You may use something like this:

CredentialCache cache = new CredentialCache ();

cache.Add(new Uri( WSProxy.Url ),"Basic",new NetworkCredenti al( "youruser",
"yourpwd", "yourdomain ") );
cache.Add(new Uri( WSProxy.Url ),"Negotiate" , new
NetworkCredenti al("youruser", "yourpwd", "yourdomain ") );

WSProxy.Credent ials = cache;
And depending on your Auth method, the appropiate credential will be used.
Always remember that the DefaultCredenti als property contains the system
credentials of the current security context. For client applications, these
represent the user name, password, and domain of the user who is currently
logged in. For ASP.NET applications, the default credentials are the user
credentials of the logged-in user or the user being impersonated.

Regards,
Hernan.

--
Hernan de Lahitte
Lagash Systems S.A.
http://weblogs.asp.net/hernandl
This posting is provided "AS IS" with no warranties, and confers no rights.

"Wild Wind" <no****@blackho le.com> wrote in message
news:2l******** ****@uni-berlin.de... Hello Hernan,

Thanks for your answer.

Is there a way of knowing whether the dialog box that
comes up on my client site requires NTLM or Basic authentication?

As I said, the dialog comes up whichever site you visit using
a web browser - I assume it must be something they have set up
on their firewall.

Will it matter if I just use "Negotiate" ?
Thanks in advance,

Akin

"Hernan de Lahitte" <he****@lagash. com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
If you need to pass certain credentials to your proxy WS class, just use
something like this:

CredentialCache cache = new CredentialCache ();
cache.Add( new Uri( WSProxy.Url ), "Negotiate" , new NetworkCredenti als(
"youruser", "yourpwd", "yourdomain ") );
WSProxy.Credent ials = cache;

If you use NTLM auth in IIS, "Negotiate" will be fine. If you use "Basic" auth instead, just put "Basic" where it says "negotiate" .
--
Hernan de Lahitte
Lagash Systems S.A.
http://weblogs.asp.net/hernandl
This posting is provided "AS IS" with no warranties, and confers no

rights.

"Wild Wind" <no****@blackho le.com> wrote in message
news:2l******** ****@uni-berlin.de...
Hello,

I have an application which calls a web service across the
Internet from a client machine.

The site that I have deployed the application to is such that
to browse the Internet using a web browser, a person needs to
do the following:

(a) ensure that a proxy server address is specified;

(b) enter a username and password into an authentication dialog
that comes up whenever they start up the web browser.

I am finding that as a result, I cannot connect at all to the
Internet directly.
I have deployed the same application on other sites that use
a proxy server to connect to the Internet by specifying the
proxy server address in my config file and using this address
to create a proxy for the web service using the following code:

Dim WSProxy as MyWebServicePro xy
WSProxy.Proxy = New WebProxy(proxyS erverAddresss, True, _
Nothing, CredentialCache .DefaultCredent ials)
WSProxy.CallWeb ServiceMethod()

However, this works at client sites where I *don't* have to specify
further authentication before web browsing. In other words, it
*doesn't* work for the client site first mentioned above.
My questions are:

When someone supplies the authentication details when they want
to use the web browser, are those details added to a CredentialCache ?

If so, can I get at this CredentialCache to get these credentials?

If not, should I create my own credentials based on the username,
password and domain that the user normally enters when accessing
the web via a web browser?

TIA,

--
Akin

aknak at aksoto dot idps dot co dot uk



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7522
by: Angelo Vargheese | last post by:
Hi, I am trying to retrieve XML created by ASP pages on different servers and display them on a single ASP.Net page. I was planning to use the XMLDocument and XMLResolver objects like below: xmlResolver.Credentials = CredentialCache.DefaultCredentials xmlDoc = New XmlDocument xmlDoc.XmlResolver = xmlResolver
4
2208
by: Grind Boy | last post by:
Hi, I'm writing this off the top of my head as I don't have the exact information to hand. We are attempting to set up a secure internet site using ASP.NET on IIS5. We are having some authentication problems early on in the project. The plan is to have 1 ASP.NET (IIS) forms application serving user requests and another ASP.NET (IIS) webservice interfacing to the database.
4
2418
by: clintonG | last post by:
When VS.NET creates a web.config file it writes a default <authentication mode="Windows" /> entry. Let me see if I got this right... 1.) It does so because I am running locally and my local Windows user account is being used by VS.NET leaving me a bit confused as when an application is run locally I am not challenged for credentials even if I request the application from a separate instance of IE.
1
4668
by: TrinityPete | last post by:
Hi all, I have a little problem that is really bugging me. I have a windows forms application that calls a web service (VS2005 and Framework 2). As part of the call to the web service I set the credentials of the webservice proxy to System.Net.CredentialCache.Default credentials. The call fails with security 401. I then change the credentials of the proxy to new NetworkCredential() using the same details as I log on to my own machine and...
2
5979
by: mbrand | last post by:
When trying to connect to my web service from a client application, the System.Net.CredentialCache.DefaultCredentials doesn't authenticate properly. I can see in the event viewer on the server (windows server 2003) that my domain/username are getting passed properly but it gives a 529 error. If I hard code in my credentials using: Service.Credentials = new System.Net.NetworkCredential("Username", "Password", "Domain") it authenticates...
0
1528
by: ndskim | last post by:
Currently I have the Web Services Proxy code generated by the WSDL.Exe command line. My Web app consists of ASP.NET in VB 2005 version. Here is what I have in the sample code: ' Set Proxy Credentials to the current network DefaultCredentials. With lds_WebService
2
1404
by: =?Utf-8?B?V2luRGV2?= | last post by:
How can I get/set the dafault login information for a machine?
4
2467
by: dk9 | last post by:
The Situation: I'm working in my browser at a secured site (https). At the same time I need my application to get and parse some urls from that same site. What I've tried: I've login with my browser, but when trying to get the pages using WebRequest from my application I can only get the "you need to login page". I've then put a WebBrowser control in my application and do the login
0
1029
by: =?Utf-8?B?QXR1bFN1cmVrYQ==?= | last post by:
Hi I have a two virtual directories(say VD 1 & VD2) hosted on same web server. Both are configured to use Windows NT authentication. I hosted some web pages to VD1 and there is web service running on VD2. I want to consume the web services (VD2) from the web pages (VD1). For that I am using HttpWebRequest object.
0
9480
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.