Facebook Like API - c#

I'm using facebook sdk. After the user authenticates to my application, I have his 'Likes' permission.
Can I add "like" to a product page automatically?

I'm not 100% sure on what you're asking, but here is some information which may be relevant.
Requesting a 'user_likes' permission will give you access the items a user has previously liked.
In order to programatically like something, (I believe) that entity has to exist within facebook - taken from http://developers.facebook.com/docs/reference/api/
/OBJECT_ID/likes Like the given object (if it has a /likes connection)
To do this you'll have to request the 'publish_stream' permission and then do something like:
// untested!
var app = new FacebookApp();
app.Post("OBJECT_ID/likes");
Failing that you'll have to add a like button (http://developers.facebook.com/docs/reference/plugins/like/) where the user will have to click themselves
Hope that helps :)

If I understand your question correctly, you want to add like buttons to product pages on your site. You are looking for the open graph api.
http://developers.facebook.com/docs/opengraph/

Related

What are the ways to post a tweet to twitter with asp.net c#? [duplicate]

With Twitter's new OAuth interface, their API is now many times more complex than what it was. And I haven't even looked at Facebook's API yet.
What I'm wondering if there is a method that employs some higher-level, existing code or interfaces to make this a simpler task.
All I want to be able to do is initiate a Twitter tweet or Facebook share on the user's behalf and be able to control the initial text of those messages, from an ASP.NET application.
I found some similar questions on SO, but they had no answers.
EDIT: I know there are things like AddThis and ShareThis, but I need something that will give me control over the default message. It must contain a link with a code that is specific to the current user.
Twitter Integration...
For making Tweets from an ASP.NET application on users' behalf, check out Twitterizer. It's a free, open-source project for integrating with Twitter from .NET applications.
I agree that using OAuth can be a bit daunting, but the Twitterizer API wraps up most of the complexity. I've written an article on using Twitterizer in an ASP.NET application that you may be interested in: Integrating Twitter Into An ASP.NET Website Using OAuth. After reading the article, download the code sample at the end, which is a working demo showing how to use Twitterizer to post a tweet from an ASP.NET website.
Facebook Integration...
For integrating with Facebook, chcek out the Facebook Developer Toolkit. Like Twitterizer, it's an open-source, free API and should get you going in the right direction.
Happy Programming!
After looking around for a while, I found sharethis.com. They have various share buttons you can add to your site that send Twitter tweets, Facebook shares, etc.
It looks like it also supports options to control the URL, so I could modify this to include whatever URL I need.
I haven't yet figured out if I can control the default message text. I'm looking into that.
But it seems like this is probably the simplest way to accomplish what I want.
This is probably what you're after for twitter: https://twitter.com/about/resources/buttons#tweet
Let's you configure a button (or URL to redirect to) that starts the user off with some default text. The user can change the text before they post.
Don't know about facebook.
Twitter Integration:
Check this code and link/article simple and easy :
protected void btnTweet_Click(object sender, EventArgs e)
{
string oauthAccessToken = Session["twtoken"].ToString();
string oauthAccessTokenSecret = Session["twsecret"].ToString();
OAuthHelper oauthhelper = new OAuthHelper();
oauthhelper.TweetOnBehalfOf(oauthAccessToken, oauthAccessTokenSecret, txtTweet.Text);
if (string.IsNullOrEmpty(oauthhelper.oauth_error))
Response.Write("Twit Posted Successfully");
else
Response.Write(oauthhelper.oauth_error);
}
Read more how to get access token and secret key and download OAuthHelper and OAuthUtility Class below is the link -
How to post tweet on behalf of an user from asp.net using oauth authentication
Login with twitter using oauth authentication in asp.net and get access token, screen name and userid

Javascript SDK in ASP.NET C#

I am building this Website in ASP.NET that needs a Log in with Facebook button (and later with Google) integrated with it to create an account.
I have looked at some great sources like
http://www.aspdotnet-suresh.com/2012/04/aspnet-integrate-facebook-login.html
and
http://facebooksdk.net/docs/web/getting-started/
[1] However, those examples never deal with Masterpages and content placeholders. So when I am trying to integrate them in the content pages, I get errors because for instance the login button called
"fb:login-button scope="email" data-size="large" data-show-faces="false" data-auto-logout-link="true" onlogin="window.location='/Main.aspx'">
Log in with Facebook < fb:login-button>"
is not accepted without the html tag
html xmlns:fb="http://www.facebook.com/2008/fbml">
which I cannot place on a content page anyways.
[2] Also, I want the user to create an account using their Facebook login. The account is really meant to be used as an instance so that a parent can sign up multiple children for a Summer Program, so all I need the application to do is associate the Facebook login with a new/existing account on my application. Any tips on how to handle this would also be greatly appreciated.
[3] Lastly, after a user logs into facebook, I would like to see them redirected to another page. However, in the code-behind file for the page, I cannot use the Facebook attributes that were written in Javascript and since the Facebook button was not an element of the toolbox, I cannot create an event handler for that. Instead, I had to write
onlogin="window.location='/Main.aspx'
within the tags of the Facebook button. This is not ideal because that means everytime I click that Facebook button, it will redirect me to Main.aspx. Meaning that if I were logged into Facebook already, and ran the Web site, I would click on "Log out" and still access the Main.aspx page...
Hope there's someone out there that has been in the same situation... or can help me!
I have been researching this for 12 hours straight now and cannot get anywhere :(

Is there a way to customize the Thinktecture.IdentityServer.v2 login page?

I'm using the Thinktecture.IdentityServer.v2 app to perform SSO for a couple of internal apps but would like to customize the login page for each application to have a smoother user experience. I can't seem to find a way to do that.
Can the login page be customized depending on the source application from where the client is comming?
"I can't seem to find a way to do that." - How hard have you tried? ;)
The RP has the extra data fields - so you can hang like a CSS name off the RP in the registration database. Further you can get to that RP data from the signin page - quoting the comment in AccountController:
// you can call AuthenticationHelper.GetRelyingPartyDetailsFromReturnUrl to get more information about the requested relying party
btw - IdentityServer's github repo has an issue tracker - you should use that for questions.
You can always have the RP pass a custom query string param and customize off of that. But you're outside the bounds of WS-Federation at that point. Plus, you must think about the nature of SSO -- the user is really signing into the IdP, not the app. So changing the IdP to look like the app is somewhat disingenuous.
I have solved this by customizing the SignIn.cshtml to adjust the style to what I need. Additionally, I have server side code in the top of SignIn.cshtml that does some string matching on the ReturnUrl (Request.QueryString["ReturnUrl"]). Then I show a different logo and header text based on some values I know to be unique for the different RP urls.
When upgrading to a new version of the ThinkTecture MVC, it will be a small job to update only this file to your specifics (just remember to have a copy of your modified SignIn.cshtml before you upgrade).

How to prevent the Facebook Application to ask any permission?

I have a facebook App and it works.
But when users go to the app page it try to do access users base information. It asks
permission(just first time). Be able to see anyone without any question.
I wanted to make an example of this is the appropriate:
https://www.facebook.com/GKFXPhilippines/app_155718427915844
I don't want to come out the following screen;
I used MVC;
in controller page had default this line:
[FacebookAuthorize("email", "user_photos")]
I removed them and solved my problem.

ASP.Net /IIS Automatic Site Creation

I am looking for some open source ASP.net script that basically creates an IIS site automatically. Basically a user will enter the domain name they want (myname.mysite.com [it will always be a subdomain of mysite.com]) they would pick a username and password, and enter some other contact information. I would also add some other options that are specific to our program but these will be coded later and are not important to this question. Once they click submit it would create the Databases, DNS, create default pages, set permissions to those pages, etc.. Has anyone seen anything that can do this or would I need to create something like this from the ground up?
You can use Microsoft.Web.Administration as in this blogpost
Or you can use System.DirectoryServices as shown here

Categories

Resources