Api Keys in Query String with WCF Data Services
I'm using query string based api keys for my WCF Data Service. I can h开发者_如何学Pythonandle this on the server pretty easily -- How would you implement API key in WCF Data Service?
However, how do I send the extra query string arguments from the client, using the Add Service Reference feature of VS2010? I saw an example for doing it when querying, but certainly not when adding/updating objects.
You have several options:
Add it to the "query string" via
.AddQueryOptions ()
see http://msdn.microsoft.com/en-us/library/cc646860.aspx
and example http://social.msdn.microsoft.com/Forums/en-GB/adodotnetdataservices/thread/226c47f7-f7bc-4450-8dff-e1136e8404baUse
DataServiceContext.Credentials
see http://msdn.microsoft.com/en-us/library/system.data.services.client.dataservicecontext.credentials.aspx
and http://msdn.microsoft.com/en-us/library/system.data.services.client.dataservicecontext.aspxUse the
Request header
see http://msdn.microsoft.com/en-us/library/gg258441.aspx
and http://msdn.microsoft.com/en-us/library/system.data.services.client.dataservicecontext.sendingrequest.aspx
精彩评论