473,394 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

NetworkCredential based on DefaultCredentials

I am running an VB.Net app which calls an ASP.Net Web Service and this
service accesses SQL Server.
The Web Service & SQL Server run on separate Windows 2000 server on the same
domain.
As we don't use Kerberos, the only means to flow the original user
credentials from the VB.Net app right thru to SQL Server is to set the web
service object credentials parameter in the VB.Net app.

The credentials is created based on the following code
oCredentials.Add(New Uri(oRollOrderAutomation.Url), "Basic", New
System.Net.NetworkCredential(InputBox("Enter Windows Login Name: ",
"Username", "my login"), InputBox("Enter Windows Password: ", "Password",
"my password"), "my domain"))

Without prompting the user to rekey their windows username & password is
there some way to pass the current windows network connection to the
credentials object?

Regards

Peter


Nov 20 '05 #1
3 13557
Hello Peter,

Thanks for posting in the group.

After reviewing the question, I feel you want to get the current credential
of VB.NET app programmatically and use it to access web service. Please
correct me if I have misunderstood the question.

Based on my experience, we could use CredentialCache.DefaultCredentials to
get the system credentials for the current security context in which the
application is running. So you could try to use it in code to see if it
works under this situation.

Dim a As New server.Service1()
a.Credentials = CredentialCache.DefaultCredentials;
MessageBox.Show(a.HelloWorld()) // Call the web service

Does that answer your question?

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: "Peter Lapic" <pl****@shop-a-docket.com.au>
!Subject: NetworkCredential based on DefaultCredentials
!Date: Mon, 20 Oct 2003 15:18:10 +1000
!Lines: 27
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!Message-ID: <Ou**************@TK2MSFTNGP12.phx.gbl>
!Newsgroups: microsoft.public.dotnet.languages.vb
!NNTP-Posting-Host: 61.88.149.94
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:148303
!X-Tomcat-NG: microsoft.public.dotnet.languages.vb
!
!I am running an VB.Net app which calls an ASP.Net Web Service and this
!service accesses SQL Server.
!The Web Service & SQL Server run on separate Windows 2000 server on the
same
!domain.
!As we don't use Kerberos, the only means to flow the original user
!credentials from the VB.Net app right thru to SQL Server is to set the web
!service object credentials parameter in the VB.Net app.
!
!The credentials is created based on the following code
!oCredentials.Add(New Uri(oRollOrderAutomation.Url), "Basic", New
!System.Net.NetworkCredential(InputBox("Enter Windows Login Name: ",
!"Username", "my login"), InputBox("Enter Windows Password: ", "Password",
!"my password"), "my domain"))
!
!Without prompting the user to rekey their windows username & password is
!there some way to pass the current windows network connection to the
!credentials object?
!
!Regards
!
!Peter
!
!
!
!
!
!
!

Nov 20 '05 #2
Actually that was my first approach and this uses NTLM as
the authentication type. Whilst connecting to the Web
Service was fine, the connection to SQL Server from the
Web Service failed. Apparently this is a delegation issue
and because we don't have AD and Kerberos my other choice
was to use Basic Authentication.

I tried to pass the DefaultCredentials as oCredentials.Add
(New Uri(oRollOrderAutomation.Url), "Basic",
CredentialCache.DefaultCredentials) but I got an error
saying Default credentials cannot be supplied for this
particular authentication type.

I am not using anonymous access in IIS as this defeats
the purpose of identifying the actual user in SQL Server.

Regards
Peter
-----Original Message-----
Hello Peter,

Thanks for posting in the group.

After reviewing the question, I feel you want to get the current credentialof VB.NET app programmatically and use it to access web service. Pleasecorrect me if I have misunderstood the question.

Based on my experience, we could use CredentialCache.DefaultCredentials toget the system credentials for the current security context in which theapplication is running. So you could try to use it in code to see if itworks under this situation.

Dim a As New server.Service1()
a.Credentials = CredentialCache.DefaultCredentials;
MessageBox.Show(a.HelloWorld()) // Call the web service

Does that answer your question?

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!From: "Peter Lapic" <pl****@shop-a-docket.com.au>
!Subject: NetworkCredential based on DefaultCredentials
!Date: Mon, 20 Oct 2003 15:18:10 +1000
!Lines: 27
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!Message-ID: <Ou**************@TK2MSFTNGP12.phx.gbl>
!Newsgroups: microsoft.public.dotnet.languages.vb
!NNTP-Posting-Host: 61.88.149.94
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl! TK2MSFTNGP12.phx.gbl!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:148303!X-Tomcat-NG: microsoft.public.dotnet.languages.vb
!
!I am running an VB.Net app which calls an ASP.Net Web Service and this!service accesses SQL Server.
!The Web Service & SQL Server run on separate Windows 2000 server on thesame
!domain.
!As we don't use Kerberos, the only means to flow the original user!credentials from the VB.Net app right thru to SQL Server is to set the web!service object credentials parameter in the VB.Net app.
!
!The credentials is created based on the following code
!oCredentials.Add(New Uri (oRollOrderAutomation.Url), "Basic", New!System.Net.NetworkCredential(InputBox("Enter Windows Login Name: ",!"Username", "my login"), InputBox("Enter Windows Password: ", "Password",!"my password"), "my domain"))
!
!Without prompting the user to rekey their windows username & password is!there some way to pass the current windows network connection to the!credentials object?
!
!Regards
!
!Peter
!
!
!
!
!
!
!

.

Nov 20 '05 #3
Hello Peter,

That is correct. I discussed it with our colleagues. You can not pass the
the user token of current process or thread to the web
service. Current Framework only supports Basic and Digest authentic.

Dim a As New server.Service1()
Dim c As New CredentialCache()
c.Add(New Uri("http://server"), "Digest", New NetworkCredential("yhhuang",
"XXXXXXX", "domain"))
a.Credentials = c
MessageBox.Show(a.HelloWorld()) // Call the web service

So we have to pass our username and password manually under this situation.
Thanks very much and please feel free to post here if there is any unclear.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4

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

Similar topics

1
by: surya | last post by:
Hi, I have a COM+ out of proc service that is configured to impersonate the user making the call to the COM+ service. Is there a way to create a NetworkCredential object based on the current...
2
by: Prathiraj | last post by:
Hi All, I'm trying to access a web page from C# code. Since I'm behind a firewall/proxy, I creat a webproxy and NetworkCredential to access the web page. It works fine. In this way, I have to...
0
by: Craig | last post by:
We have an anonymous web application trying to talk to a windows authenticated webservice. This is currently failing with 401 Access Denied errors. We have found that we can get this to work by...
1
by: Marco | last post by:
Hi All, this is the scenario: - "Hello World" web service on Machine A - winform client on Machine B - asp.net webform client on Machine B Everything is Windows Server 2003 on the same...
3
by: Patrick Fogarty | last post by:
I am programming what is to be a web service client that will use an HTTP-POST to request and retrieve data. The remote server (written in java for what it's worth) requires basic authentication...
0
by: Damian Cugley | last post by:
I am trying to write a console app that connects to an instance of Reporting Services' ReportServer service. I'm using custom authentication (based on FormsAuthentication) rather than Windows...
2
by: YK | last post by:
Hi I have a Web Application that connects to Exchange WebDAV using a class that I found on http://www.codeproject.com/dotnet/exdav.asp. This class requires a NetworkCredential object in order to...
0
by: Niklas Uhlin | last post by:
I have an ASP.NET 2.0 site running on XP SP2 that uses Windows Integrated Authetication. In web.config I have the following: <system.web> <authentication mode="Windows" /> <identity...
3
by: antonyliu2002 | last post by:
I have a website (call it WinAuthWeb) that uses Integrated Windows Authentication. In my ASP.NET web application, I collect user name, password and domain info and pass them to WinAuthWeb for...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
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,...
0
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...
0
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...

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.