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 6954637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:37:53+00:00 2026-05-27T14:37:53+00:00

I have build a wcf web service that simply provides MS Dynamics SQL data

  • 0

I have build a wcf web service that simply provides MS Dynamics SQL data to a CRM hosted Silverlight application. Currently the web services are hosted in IIS and are only available via HTTPS so the contents of the messages are secure. I’m now ready to implement the next level of security that has to do with who is logged into the Silverlight client application. I’d like to pass that information to the web service and then use it when creating the SQL Server Connection object. The results will be that the MS Dynamics Database will then only return data that the connected user is authorized to view.

This model is different from the standard model that consists of authenticating a given user for access to the web service. Instead, in my model everyone is granted access to the web service and the results of the SQL queries are based on the user name and password for a given user.

For Clarification: The Silverlight application collects the user name and password from the user when they log on to the application. This is the information that eventually needs to be used by the web service when the web service makes the connection to the SQL Server database. So my goal is to have the Silverlight applicaiton pass the username and password to the web service in such a way that the web service can retrieve it and use it when creating the Connection object.

I’m considering something as simple as adding the user name and password to each web service request. However I’d rather be able to use the standard method for passing user credentials but I can’t seem to find any way to get to the password. The user name is accessable throught the OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name.

Any ideas?

  • 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-27T14:37:54+00:00Added an answer on May 27, 2026 at 2:37 pm

    You can use the wsHttpBinding for passing credentials to your service, this will however at the very least require you to send the credentials with message security. You can combine this with anonymous authentication in IIS. This way, everyone can access the service on a transport level, but you’ll be able to handle the credentials yourself.

    To expand, I have a WCF service running in IIS with HTTPS and anonymous authentication. In my web.config I’ve set up a wsHttpBinding, like this:

    <bindings>
    <wsHttpBinding>
        <binding name="CredentialsBinding" />
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    

    In my behaviors, I’ve set up a servicebehavior for a custom username/password validator, like so:

    <behaviors>
      <serviceBehaviors>
        <behavior name="DefaultBehavior">
          <serviceCredentials>
            <userNameAuthentication
            userNamePasswordValidationMode="Custom"
           customUserNamePasswordValidatorType="MyNamespace.CredentialValidator, MyNamespace"/>
          </serviceCredentials>
           </behavior>
      </serviceBehaviors>
    </behaviors>
    

    The validator looks like this:

    namespace MyNamespace.CredentialValidator
    {
        public class CredentialValidator:  UserNamePasswordValidator 
        {
            public override void Validate(string userName, string password)
            {
                // you can now handle the username and password passed to your service
                // with a wsHttpBinding through HTTPS
            }
        }
    }
    

    –EDIT

    Rory Primrose describes what you’re probably looking for in his article WCF Security: Getting the password of the user, using a CustomUserNameSecurityTokenAuthenticator to get the password for further use.

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

Sidebar

Related Questions

I have a web site and build a wcf service in it. I can
I have a typical Silverlight application with a WCF service and I am using
We have been using a web application framework to build apps that need to
I'm writing my first WCF service (as WCF application, that is hosted inside my
Does anyone have any experience with how well web services build with Microsoft's WCF
I have to build an HTML table that shows data for users versus pages
I currently have a web service built on WCF. It's still in its infancy,
I have an application that is built using ASP.NET, with an embedded Silverlight Object
I have written a WCF service that I am hosting in IIS7 as a
I have a WCF web service project, say FooService.vbproj with a FooService.svc endpoint. Its

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.