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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:38:26+00:00 2026-05-30T02:38:26+00:00

I have a requirement where-in my Silverlight application needs to connect to a WCF

  • 0

I have a requirement where-in my Silverlight application needs to connect to a WCF service to fetch data, through an intermediate WCF service, which is hosted in the same domain as the Silverlight. That is, the Silverlight is going to make a call to the Intermediate Service, which will attached the IssuedToken along with the request and send it to the main WCF client. The main WCF service would retrieve the claims from the Thread.Principal.

    var binding = new WS2007FederationHttpBinding(WSFederationHttpSecurityMode.TransportWithMessageCredential);
    binding.Security.Message.EstablishSecurityContext = false;

    var factory = new ChannelFactory<IMyService>(binding, new EndpointAddress("https://myservice.cloudapp.net:4432/MyService.svc"));
    var channel = factory.CreateChannelActingAs(((ClaimsIdentity)((ClaimsPrincipal)HttpContext.Current.User).Identity).BootstrapToken);

    var data = channel.GetData();

But this code piece fails. I am unable to find property documentation on how to achieve this. Can anyone please help me with this.

Thanks,

  • 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-30T02:38:27+00:00Added an answer on May 30, 2026 at 2:38 am

    You need to:
    1. authenticate opposite the ADFS STS service to obtain a SecurityToken
    2. query your service with a channel using “CreateChannelWithIssuedToken”, along the lines of:

            var token = GetToken();
    
            string uri = SERVICE_URL;
    
            EndpointAddress address = new EndpointAddress(uri);
    
            var binding = new WS2007FederationHttpBinding(WSFederationHttpSecurityMode.TransportWithMessageCredential);
            binding.Security.Message.EstablishSecurityContext = false;
    
            _factory = new ChannelFactory<IService>(binding, address);
            _factory.ConfigureChannelFactory<IService>();
            _factory.Credentials.SupportInteractive = false;
    
            _service = _factory.CreateChannelWithIssuedToken<IService>(token);
    

    The code for GetToken will look as follows:

        public static SecurityToken GetToken(string username, string password, EndpointAddress federationServiceProxyAddress, EndpointAddress relyingPartyIdentifier)
        {
            var binding = new UserNameWSTrustBinding
            {
                SecurityMode = SecurityMode.TransportWithMessageCredential
            };
    
            var factory = new WSTrustChannelFactory(binding, federationServiceProxyAddress)
            {
                TrustVersion = System.ServiceModel.Security.TrustVersion.WSTrust13,
            };
    
            factory.Credentials.SupportInteractive = false;
            factory.Credentials.UserName.UserName = username;
            factory.Credentials.UserName.Password = password;
    
            try
            {
                var requestSecurityToken = new RequestSecurityToken
                {
                    RequestType = WSTrust13Constants.RequestTypes.Issue,
                    AppliesTo = relyingPartyIdentifier
                };
    
                var channel = factory.CreateChannel();
                return channel.Issue(requestSecurityToken);//, out requestSecurityTokenResponse);
            }
            catch (MessageSecurityException exception)
            {
                // Invalid username or password
                throw new MessageSecurityException(exception.Message, exception);
            }
            catch (Exception exception)
            {
                // Unknown error
                throw new Exception(exception.Message, exception);
            }
            finally
            {
                try
                {
                    if (factory.State == CommunicationState.Faulted)
                    {
                        factory.Abort();
                    }
                    else
                    {
                        factory.Close();
                    }
                }
                catch (Exception) { }
            }
        }
    

    Hope this helps…

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

Sidebar

Related Questions

I´m deploying a small Silverlight application, which consumes data from a WCF DataService then
I have the requirement as follows to create an installer for a Silverlight application
I have a requirement to take client side XAML (from Silverlight) and create a
I have requirement like, suppose I have a 'property' table which has 'ListingKey' field
I have requirement as following like showing ABPeoplePickerNavigationController in tabbar based application. I researched
I have a silverlight app and winform app. My requirement changed to Display the
WPF and Silverlight have a data binding model whereby I can provide a Binding
I am new to silverlight, WCF RIA services. We have a medium size financial
Can I know how to enable arabic in Silverlight?? I have a requirement in
I have requirement in which I have tableview as a subview of imageview. Now

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.