I've been asked to develop a facebook application that allows users of their current system to find each other using a this facebook app. Unfortuantely their requirements are that it has to be build in ASP.NET 3.5 (Easier for their clients distribution purposes).
I am a experienced PHP developer although I have in the past used C# for windows applications. I have found a facebook api that looks suitable - http://facebooksdk.codeplex.com/. The problem I am having is that all availble examples use .NET 4.
I must admit I'm struggling to get to grips with the api and I know from the past I learn best through example. Could anyone provide a link to examples or some basic code I experiment with?
I would really appreciate any advice or input you have on the situation.
Thanks, Jason.
Update
Using the answer below and the following resource (http://osnapz.wordpress.com/2010/04/23/using-asp-net-with-facebooks-graph-api-and-oauth-2-0-authentication/) it is easy enough to make start on facebook application.
One issue I also had was the server (1&1) I was using needed proxy setting added to the web.config
Example:
<system.net>
<defaultProxy>
<proxy
usesystemdefault = "false"
bypassonlocal="false"
proxyaddress="http://ntproxyus.lxa.perfora.net:3128"
/>
</defaultProxy>
</system.net>
Until you become more familiar with ASP.NET, I would suggest integrating with the FacebookClient() rather than the more involved
the one thing you will have to understand is the difference between dynamic and using IDictionary. For C# 4.0 and up you can use dynamic, but for 3.5 you must use the old IDictionary.
Here's a good example of how to convert from dynamic to IDictionary (so you can use the 4.0 examples as a guide)
var fb = new FacebookClient("{access_token}");
dynamic result = fb.Get("/me");
var name = result.name;
Response.Write("Hi " + name);
Converts to:
var fb = new FacebookClient("{access_token}");
var result = (IDictionary<string, object>)fb.Get("/me");
var name = (string)result["name"];
Response.Write("Hi " + name);
I hope that gets you on your way as far as converting the examples.
Related
Hello and thanks for reading my question.
I'm working on transitioning some code from Google.Cloud.Translation.V2 to Google.Cloud.Translate.V3 because we need to make use of the api advanced features.
We are using a TranslationClient to get us the translations (from the V2 library) but we need to instead use the TranslationServiceClient (from the V3 library.)
I'm having trouble instantiating a TranslationServiceClient with our credentials. The way to do it in V2 is straightforward:
TranslationClient.Create(GoogleCredential.FromJson("{\"the credentials\"}"));
From reading the documentation it is clear to me that to create a TranslationServiceClient without the default settings you need to use a TranslationServiceClientBuilder and give that the credentials. I couldn't find any examples, all of the code snippets use TranslationServiceClient.Create() which doesn't allow for any arguments.
Since the goal is to create a TranslationServiceClient using a json as authentication, one way to do this is as follows:
TranslationServiceClient client = new TranslationServiceClientBuilder {
JsonCredentials = "{\"the credentials\"}"
}.Build()
More info at https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code
I am trying to implement SCIM with Web Api 2 (c#) and I've found the nuget package and some documentation from Microsoft and their sample code.
My understanding from the SCIM documentation is that they just need an API with the specified user/Group methods and schemas, but in the sample code they have used a monitor and provider.
public Startup()
{
IMonitor monitor = new DefaultMonitor();
IProvider provider = new SampleProvider();
this.starter = new WebApplicationStarter(provider, monitor);
}
Their code doesn't compile even after following the instructions and getting nuget packages most probably because of the old resources on the packages that they have used, but also I don't see what is the nececity of using the package other than adding some interfaces for my controllers.
I've also found this:
SCIM (System for Cross-domain Identity Management) library for C#
But it is also a shame that the blog post that they are pointing to from MS is gone :.
So what I am asking is:
- Am I going the correct direction? Should I use the nuget?
And if yes, anything special on Web api?
Any suggestion is also very appreciated.
I am completely new to DotNetOpenAuth library and am currently trying to use it in a WebForms ASP.Net website project. I have successfully installed the library in my website using Nuget.
However, when looking at the samples for this library, I found the following 2 keys in web config. I did go to the sign-up URL mentioned, but could not get these keys. I also tried looking up the docs for this library, but could not find any thing on these 2 keys.
<!-- Google sign-up: https://www.google.com/accounts/ManageDomains -->
<add key="googleConsumerKey" value="anonymous" />
<add key="googleConsumerSecret" value="anonymous" />
Question
How do I get googleConsumerKey and googleConsumerSecret for use with my website, so I can have users login using their Google account?
It can be difficult to find, there is soooo much google stuff that they offer that sometimes the thing you want is not easy to find.
Try
https://console.developers.google.com/apis/credentials
For Capcha keys use
https://www.google.com/recaptcha/admin
I am trying to display YouTube analytics data in a .Net application (Asp.net MVC 4 to be specific) using the google api .net client
The only sample I could find for this was a JavaScript sample located here for the most parts I was able to recreate the code in .Net, The only problem is that I don't seem to be able to find the counterpart for this lines of code which returns a list of Channels for the authenticated user:
var request = gapi.client.youtube.channels.list({
// "mine: true" indicates that you want to retrieve the authenticated user's channel.
mine: true,
part: 'id,contentDetails'
});
which should be then used here in my code:
var request = youtubeAnalyiticsService.Reports.Query(
"channel=="+ channelId, fromDate, toDate,
"views,likes,dislikes" // metrics to include in report
);
What I currently do to get it to work is to copy and paste the channel Id here and therefore "hard-code" it which is not practical in this my case and used only for testing purposes.
Hopefully I'm wrong but after searching for hours I think that the .Net API might be missing this part, can anyone confirm this? and if true are there any alternatives for doing this in the .net application?
I also guess that there might be a straightforward way to just use that part of the JavaScript code in the .net application but I'm not sure how!
Any help, hint or clarification would be much appreciated :)
This should work, assuming you've already got OAuth 2 setup and youtube is a YouTubeService object that's been properly authorized:
ChannelsResource.ListRequest channelsListRequest = youtube.Channels.List("id");
channelsListRequest.Mine = true;
ChannelListResponse channelsListResponse = channelsListRequest.Fetch();
string channelId = channelsListResponse.Items[0].Id;
As of August 15, Amazon made it compulsory to sign all requests made to their Product Advertising API. I thought I had got everything working just fine but when the 15th finally came around, my web application stopped working and pretty much ever since I have been trying to find out how to sign the SOAP requests.
Amazon has an outdated sample code for signing requests that doesn't appear to work here
Basically, I need to know how to add a signature to the my requests using the most current C# SOAP API and .NET 3.5.
I hope I have given enough details, if I haven't please feel free to ask me to elaborate.
Thank You
The_Lorax
UPDATE:
I am using MVC and need to know how to add the Signature to the the ItemLookup or AWSECommerceService object. Is there an attribute that contains the signature value? How does it get attached to the request?
On this page, they say that I must include the Signature and TimeStamp parameters but the intellisense does now show any such attributes.
Check out http://flyingpies.wordpress.com/2009/08/01/17/. It has a walkthrough and a sample visual studio solution using C#, SOAP, WCF on .NET 3.5.
This library automatic sign the requests (Install-Package Nager.AmazonProductAdvertising)
https://www.nuget.org/packages/Nager.AmazonProductAdvertising/
Example:
var authentication = new AmazonAuthentication("accesskey", "secretkey");
var client = new AmazonProductAdvertisingClient(authentication, AmazonEndpoint.US);
var result = await client.SearchItemsAsync("canon eos");