[Last Call] Learn how to a build a cloud-first strategyRegister Now


Forcing NT credentials into CredentialsCache

Posted on 2007-07-30
Medium Priority
Last Modified: 2013-11-07
I have a VB.NET running under an NT account (or at least, executed by a user who is logged into the network).

I need to pass that user's credentials through to a webService, but all I get from CredentialsCache.DefaultCredentials is a set of blanks.

I can't force the user to log in as the idea is to get the app to run from a scheduled task with the command line and I don't want to store the user info anywhere since the accounts may change.

So, how can I force the app to run with so that the credentials get set in the credentialscache?

Question by:JohnC28
  • 2

Expert Comment

ID: 19613879
both the CredentialCache.DefaultCredentials and CredentialCache.DefaultNetworkCredentials return the Windows Authentication information, you shouble be able use the DefaultCredentials with web services with no problem.
but you can not see or output the credential details, it will appear blank to you.

Author Comment

ID: 19662816
Thanks - think that partially answers my question (at least, that they will appear blank even if there are there, which appears to be what you are saying???)

Accepted Solution

zeroxp earned 1500 total points
ID: 19667006
yes, when you put a breakpoint you will see the domain, username, password are blank.

you might need to check the authentication setting on the server that hosts the web service to make sure Integrated Windows Authentication is enabled. if your VB client/consumer application is running as current user, the user need able to access the server.

//here is a simple example to use the DefaultCredentials:
//after you add the web reference and have the proxy class generated
Service1 s = new Service1();
s.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
object o = s.DoSomething();

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question