Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 236093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:19:03+00:00 2026-05-11T20:19:03+00:00

I have a WCF service using BasicHttpBinding with Windows authentication. Most clients are domain

  • 0

I have a WCF service using BasicHttpBinding with Windows authentication.
Most clients are domain accounts and connect to the service using their default credentials.

Now I want to connect to the service from an ASP.NET client that is running under a local account. I want to connect to the WCF service using windows credentials (domain\user and password) that are available to the ASP.NET application.

I know I can do this in code using ClientBase<T>.ClientCredentials.

Is there a way to specify the credentials (domain\user and password) in the client’s web.config file so I don’t have to change the code?

EDIT

If it can’t be done in the configuration file, is there a way of using System.Net.ICredentials or System.Net.NetworkCredential as a credential for a WCF service?

The .NET Framework provides these as a homogenous way to provide network credentials, but with WCF this seems to have been thrown out in favour of a new incompatible system based on the unrelated System.ServiceModel.Description.ClientCredentials class.

EDIT 2

Accepting Marc’s answer to the original question – it seems there is no way to do this in the client configuration file 🙁

I would see this as a deficiency in WCF – I don’t accept that Microsoft should be deliberately discouraging us from putting credentials in the configuration file – after all they have to be stored somewhere, and the Framework includes facilities for encrypting the config file. I guess I could create a custom BehaviorExtensionElement for this, but it ought to be available out of the box.

It’s also a bit inconsistent: the system.net/mailSettings/smtp/network configuration element allows credentials to be specified, so why not WCF?

Regarding the second question about using System.Net.NetworkCredential, it seems from this blog that it is possible, at least when using Windows authentication, with the following code:

factory.Credentials.Windows.ClientCredential =
   new System.Net.NetworkCredential(name, password, domain);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:19:03+00:00Added an answer on May 11, 2026 at 8:19 pm

    You can’t specify your credentials in the config file, unfortunately – you have to do this in code (most likely because otherwise you might end up with credentials in your config file, in plain text – not a good thing….).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 167k
  • Answers 167k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer See this to change a component's config at runtime. With… May 12, 2026 at 1:35 pm
  • Editorial Team
    Editorial Team added an answer I guess, Google saves these items and can display them,… May 12, 2026 at 1:35 pm
  • Editorial Team
    Editorial Team added an answer As everybody has pointed out, Cucumber and Shoulda have fairly… May 12, 2026 at 1:35 pm

Related Questions

I have developed an ASP.NET application that includes a WCF service. This service needs
I am using a wcf basichttp adapter in biztalk using ESB guidance 1.0 i
I'm trying to convert my existing site to use WCF to communicate with my
I'm going around in circles with regards to WCF and security, so I'm listing

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.