473,804 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

NetworkCredenti al based on DefaultCredenti als

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.Ad d(New Uri(oRollOrderA utomation.Url), "Basic", New
System.Net.Netw orkCredential(I nputBox("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 13636
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 programmaticall y and use it to access web service. Please
correct me if I have misunderstood the question.

Based on my experience, we could use CredentialCache .DefaultCredent ials 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 .DefaultCredent ials;
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: NetworkCredenti al based on DefaultCredenti als
!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.publi c.dotnet.langua ges.vb
!NNTP-Posting-Host: 61.88.149.94
!Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:148303
!X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.A dd(New Uri(oRollOrderA utomation.Url), "Basic", New
!System.Net.Net workCredential( 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 DefaultCredenti als as oCredentials.Ad d
(New Uri(oRollOrderA utomation.Url), "Basic",
CredentialCache .DefaultCredent ials) 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 programmaticall y and use it to access web service. Pleasecorrect me if I have misunderstood the question.

Based on my experience, we could use CredentialCache .DefaultCredent ials 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.Credential s = CredentialCache .DefaultCredent ials;
MessageBox.Sho w(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: NetworkCredenti al based on DefaultCredenti als
!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.publi c.dotnet.langua ges.vb
!NNTP-Posting-Host: 61.88.149.94
!Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl! TK2MSFTNGP12.ph x.gbl!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:148303!X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 (oRollOrderAuto mation.Url), "Basic", New!System.Net.Ne tworkCredential (InputBox("Ente r 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 NetworkCredenti al("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
1670
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 thread's security? Using System.Net.CredentialCache.DefaultCredentials always returns the credentials of the user configured to run the out of proc COM+ server and not the credentials of the user set on the current thread. Regards
2
19071
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 give the username and password for creating the NetworkCredential object. Is there anyway that I can get the NetworkCredential object from the logged on user?
0
2617
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 writing the following code in the web application before calling the webservice: WebServiceInstance.Credentials = new NetworkCredential("username", "password","domain");
1
7290
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 domain, anonymous access turned off in IIS, Integrated Windows Authentication is checked. I use the following code to invoke the web service (same code on the winform and the
3
6935
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 as per RFC 2617 (http://www.faqs.org/rfcs/rfc2617.html). My attempts to authenticate are failing. The server requires the header to be present with the request. For security reasons, it will not reply in any way if the header is not present. ...
0
2128
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 authentication. The usual incantation for connecting to the service is via code like this: ReportingService reportingService = new ReportingService(); reportingService.Credentials = CredentialCache.DefaultCredentials; This will not work because...
2
2971
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 authenticate the HTTP request against the Exchange server, and since that my WebApp is configured in the IIS to use ONLY Integrated Windows Authentication I have the Windows identity object from which I can get only the user name. Is there a...
0
1708
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 impersonate="true" /> <authorization> <allow roles="DOMAIN\Group" /> <deny users="*" />
3
6771
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 authentication (formerly known as NTLM). I construct the user credentials like this: theUserCredential = New NetworkCredential(username, userpassword,
0
10599
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, 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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10346
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
10347
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
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6863
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
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
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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.