Simple Facebook Connect Demo in ASP.NET - c#

Does anyone have a simple and successful demo implementation of facebook connect in an asp.net application. I am developing an asp.net web application and want facebook connect to be the primary method for logging in.

I was having troubles as well, but found that this stackoverflow question got me on the right track as far as the server side stuff is concerned
However, First you have to get the facebook connect button working from here Facebook Wiki
Then detect if they are logged in or not and redirect them appropriately to a welcome page.
Detect login via Javascript
Most other actions can be done via serverside with the Facebook ToolKit. (eg get their information, friends, etc..)
The last thing I think I should mention is logging the user out, so take a look at this. Facebook Wiki: Logout
Hope this helps

As I see, all the above examples and links are really outdated. The new Facebook Graph API makes the whole process a lot easier, without the need for any other components:
http://area72.ro/general-it/how-to-login-via-facebook-in-asp-net.html

try to use the toolkit called Facebook Developer Toolkit
you have in Steve Blog a post about it, and you even download he's Starter Kit so you can view all the code :)
Hope it helps

I know you asked for ASP.NET resources. The Facebook Connect page provides some good information as well as the source to a sample implementation using PHP. Hopefully you can pull some good information from the PHP code.
http://developers.facebook.com/connect.php Check out the links on the right side.
The provided demo can be accessed here... http://www.somethingtoputhere.com/therunaround/

Related

is oAuth possible for C# Windows Application?

I have a windows application, developed in C#. where I need to perform Google oAuth so I'll get their profile. I don't want to ask the user to enter their Google Username and Password in my windows application (and of course users don't want that).
How can I do that ?
I tried
1.) Able to open Google Authentication page from my windows application, but can't figure it out how to get access token passed to my windows application.
Any inputs / suggestions ?
You can have a webBrowser control in you application. You can then let the user log in via the webBrowser control. You can then query the webBrowser control for the data.
What you are probably looking for is called 2-legged OAuth. You can get some example code here, but its in PHP. You can also see a C# Example here
I appreciate this is an old question but I'm currently looking into the same thing. From what I've found, using an embeded webBrowser as per SamFisher83's suggestion is "strongly discouraged".
I thought I'd share this guide from Google themselves.
Link to Google OAuth 2.0 guide
No doubt the OP found a way of doing it, but this was one of the first links that came up via a google search on the subject and thought I'd share the link for any future reference.

Facebook JS SDK + C# SDK Logic

I've been playing around with Facebook JavaScript SDK and Facebook SDK for .NET (Web) to try and create a simple Page tab app which does the below:
Show welcome page
If user likes the page, ask for proper extended permissions and redirect to another page reserved for fans only
Use the access token from the login to do things on the user behalf.
Anyway, my problem is with the logic of the whole thing, as the user enters the page what should I do after loading the JS SDK? It automatically shows the permissions box so that I could get the extended permissions user_likes instead of showing the welcome page.
My other issue is with the access token that is going to be used later in time. Should i store it in session state? if yes, how? What happens if i try to access it and it's expired?
I know this is a general question but please could someone guide me through the best practices to initialize and use the facebook SDK in a .NET WebForms tab app?
Thanks a lot.
(I've read through both docs on Facebook and C# SDK. Great for browsing the API but not much documentations or examples about .NET WebForms)

Is it possible to use google analytics in server?

I have a URLShortener application and I want to use Google Analytics for shorted urls. But I use Response.Redirect() method and I can't use local script of google analytics.
I want to know is it possible to have something like google analytics script in server and run it?
There is the Microsoft Silverlight Analytics Framework which also supports Google Analytics.
I would assume that they do this in C# code, which should be adaptable to be used inside server-side code, too.
Yes, it is possible to use google analytics in server. You need to have a Google Analytics account, as explained here.
After setting up your account they will give you a unique tracking code along with a javascript code which you have to put in your website or master page which you want to track. This javascript code will do all magic for you and you can watch this information from your GA account.
You can even integrate this chart with your website, using the Google chart facility through
Google Analytics Easy Dashboard Javascript Library (more information here).
From this tutorial you can setup your website to catch GA data into your site and display in your own webpage through Google charts.
Sure, it's technically possible. All GA does is set some variables and makes an HTTP request to the GA server, which can be done with JS or by grabbing a gif from the server.
The main issue is that you won't get a lot of the data that you would expect like browser, location, OS version, etc. because the client making the request would be your own server.
It would probably be best to add some event tracking data to the redirected location and track that with GA event tracking, that way you could get a more accurate dataset.
If you do want to continue down the path of most resistance though, this is a pretty good write up of how you'd go about it. http://automateeverything.tumblr.com/post/20500736298/google-analytics-without-javascript-or-cookies It's not C# specific, but you should be able to abstract it.

Background app to monitor Facebook

I'm building an aggregator for Twitter and Facebook. Via my website users should be able to grant the app access to their Facebook and Twitter profile.
Then, my C# app will, at regular intervals, check the networks (or stream from) for new posts/likes/tweets related to that user and store the result in a database. I will not use Facebook and Twitter as an identity provider for my website.
Now my question: what library should I use best to accomplish the connection with the social networks? Can I use dotnetopenauth for this? Or are there better solutions?
I should also be able to extend the library and add whatever social network later on.
It is probably a very basic question, but I get confused due to all the possible libraries and options. I tweaked a small and simple OAuth class to connect to Twitter, but this was only capably of OAuth 1.0...
Yes, DotNetOpenAuth can help you with this. But you might want to double check the Facebook terms of service, as I thought they forbade any persistence of the data you download from them.
It is indeed possible to do so with DotNetOpenAuth, I know this because I am working on something similar. Already have it working like a charm with Twitter, working on the Facebook link at the moment. Seems like Facebook is going to give me more trouble then I expected at first.

Creating a hook into my facebook app from another site

new to facebook dev and I have read the basics to get a site up and running using the canvas setup. Nice and simple, I have also got the integration with users working ok (i.e. the signed_request).
I was wondering how it works with "sending/posting" data from one site that is anonymous (my own external to facebook) to the facebook site.
The flow I'm after is a user is looking at some content my site A (my own external site) and then clicks the "share on facebook" button (or whatever), which sends the user (and the data they were looking at) to the site B (my facebook app) to which they authenticate and then (and this is the part I dont get) can see that content on their personalised homepage within site B.
So is there a way to POST some kind of data to the facebook site? Or do I need to do something else here?
Thanks a lot.
You use the facebook API located here:
http://github.com/facebook/csharp-sdk
The .zip download includes the api that you can compile, as well as a sample project that uses it.
Reference: http://developers.facebook.com/blog/post/395/
EDIT
Here is some more info regarding the facebook graph api. I think you'll find everything you need in here: http://developers.facebook.com/docs/reference/api/

Categories