locked
WCF Data Services credentials at the Silverlight Client RRS feed

  • Question

  • Hi,

    Can anybody provide me howcan I use credentials for Silverlight Client?

    I mean something like adding a credential data to request headers during request sending. Now there is not any ability to insert credential data to request headers. I found a fewold article about this problem. Here one of them:

    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/9e90dfec-5e54-4785-b78d-391d4cc862f8/

    I did not found answers for my questions:

    1.Why we have not a credential finctionality for the WCF Data Services at the silverlight client?

    2.When it will be implemetned?

    Best Regards,

    Egor.

    Tuesday, March 23, 2010 11:35 AM

Answers

  • Hi,

    If you need custom credentials, that support is going to be available in the Silverlight 4 release. The automatic credentials passed by the browser should work even today though (without you needing to do anything).

    Thanks,


    Vitek Karas [MSFT]
    • Marked as answer by EgoRich_ Tuesday, March 23, 2010 12:23 PM
    Tuesday, March 23, 2010 11:43 AM
    Moderator

All replies

  • Hi,

    If you need custom credentials, that support is going to be available in the Silverlight 4 release. The automatic credentials passed by the browser should work even today though (without you needing to do anything).

    Thanks,


    Vitek Karas [MSFT]
    • Marked as answer by EgoRich_ Tuesday, March 23, 2010 12:23 PM
    Tuesday, March 23, 2010 11:43 AM
    Moderator
  • Silverlight 4 is released but I can't find any information on how to use custom credentials.

    I want to send an token to a WCF Data Service via the Authorization header. The service-client setup is cross-domain.

     

          var ec = new EC.CoreEntities(new Uri("http://127.0.0.1/CoreService.svc"));
          ec.HttpStack = System.Data.Services.Client.HttpStack.ClientHttp;
          ec.Credentials = new NetworkCredential("test", "tets");
          ec.Media.BeginExecute((a) =>
          {
    
          }
          , null);

    What steps are necsessary for me to get this to work?

    Thanks!

     

    Monday, April 19, 2010 8:51 AM
  • Hi,

     If you plan to use a cookie based authentication mechanism , please take a look at this blog post :
    http://blogs.msdn.com/phaniraj/archive/2009/09/10/using-the-ado-net-data-services-silverlight-client-library-in-x-domain-and-out-of-browser-scenarios-ii-forms-authentication.aspx
    If
    you want to modify the headers of the web request made by the client , you can hook into the SendingRequest event and then modify the Authorization header.
    The steps you have above should be enough to send an Authorization header with the Username and password encoded.
    What kind of errors do you see when you try to run the above code ?
    A Fiddler trace would be helpful.


    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    • Proposed as answer by macthestack Tuesday, April 20, 2010 1:13 PM
    Monday, April 19, 2010 4:18 PM
    Moderator
  • Thank you!

    I do want to send an "Authorization" header and hooking up to the SendingRequestevent works great!

    However, providing Credentials as I did in my code does not work. Atleast not writing to the headers. I can't get Fiddler to intercept but when I debug my service I get the request but not any modification in the headers.

    /m

    Tuesday, April 20, 2010 1:17 PM