First of all, sorry for my newbie question...
I am google-ing for something like that for days, but still no luck.
I can't find any examples for using the Facebook C# SDK
with Facebook Page Tab applications.
Unfortunately most examples are for Facebook Canvas applications
and I can't make them work with a Page Tab application.
I really need to see a working example of the following:
Get whether the User Liked my page, or not.
If the User Liked my page, show an "authorize" link/button.
On clicking the "authorize" link/button, ask for User's permission to:
access his info, post to his wall, etc.
(using facebook's usual dialogs for that)
After the User accepts, redirect him to the "member's only" page.
(...inside the tab application frame. not a canvas-type frame)
Whenever an "authorized" User comes back to my tab app,
he should be automaticaly redirected to the same "member's only" page.
(I suppose if I have an example for the previous steps,
I won't have a problem figuring this out)
Building app for canvas is the same as making it for Page tab. The only difference is the so called "fangate" (liker/non-likers).
This can be used out of the box only on page tabs and the only thing you need is to decode the signed request passed by facebook.
There is good explanation for doing this with C# here:
Decode Signed Request Without Authentication
Related
I have this requirement for my project. Already there is an existing windows form application,
Which sends email when a button is clicked. There's a lot of code behind the application.
It validates the field serial number which is a text box by connecting to database.
The validation error pops up as another windows form.
It generates a report form after sending an email. There's a configuration button which is accessible only to particular users which opens configuration form which has details of email settings.
Now All this is developed using windows forms. My new requirement is i need to develop
the same in a ASP.NET web page having similar functionality.
I tried using click once deployment, but that's not they needed. they want it as a webpage.
Is there any tool or way i can show the application in ASP.NET web page?
Do i need to start the coding from scratch?
Thanks in advance
As to what Rex said, you are going to have to start from scratch. The coding behind it is different. Validation and functions work differently in asp.net than they do in .net.
You will have to start from scratch for reasons already mentioned. If this is your first ASP.net application here are a few tips for what you want to do:
1- For validation and transfer to the email report to work in a similar way you can use Response.Redirect or Server.Transfer or JavaScript. All of those methods have pros and cons, see Server.Transfer Vs. Response.Redirect for an example of the first two. For javascript you'll need to write a javascript function in the .aspx file or inject javascript in the page with response.write.
2- If you validate with JavaScript you also need to validate server side to make sure someone doesn't try to pass bad values to you. JavaScript can be disabled and users can call your report page and configuration page directly, while with windows forms you control that flow you don't on webpages.
3- You'll probably have to use CSS to style elements in your email configuration form and in your initial form. Positioning, docking, anchoring and so on is completely different in webpage and done with CSS. Have fun learning the CSS boxing model, what absolute positioning is, and what clear and float do ;)
4- The most important thing is that the Web is stateless. You can't use private members to keep information between page reload on the web. When you pass a value between 2 pages the first one doesn't exist anymore so you can't just do Class.somemembervariable as usual. Check out what viewstate, sessionstate and querystring are. When your page reload, without these, everything is loss. Clicking a server-side button cause the page to reload, which you need to handle (it's called postback). This also implies that when you serve the report page you will have to pass some Id for the email and check the user, so when you call the 2nd page you need to pass to it some id so it can work. I spent more time on this one because it's the most important difference between asp.net and windows form.
5- For restricting access to your email settings page you will probably need to use windows authentification if this is an Intranet site or Forms authentification if this is an Internet site. Check Starting ASP.NET Forms Authentication for some basic overview.
6- ASP.Net has a codebehind file where you write the actual code, and an .aspx page where you put the html tags, javascript, styles, and data binding with <%= %> tags.
7- You will probably have to work with IIS as well to make your website work unless you work at a very formal place where specific peoples take care of that. At the very basic you'll have to create an application pool, make it compatible with 32/64 bits and set up authentification in IIS.
I am working on an application for Windows Phone 8 and I'd like to give the possibility to the users to login with their Facebook account, so they won't have to create an account on my application.
I saw the Facebook SDK for .NET and decided to use it because it seems to be really efficient and popular.
As a beginner, I followed the tutorial in the doc of the SDK : http://facebooksdk.net/docs/phone/tutorial/
I did the exact same thing that in the tutorial, everything is okay since I login. I click on the login button, I'm redirected to what they call the "FacebookLoginPage" in the tutorial (a .xaml with an empty grid so the webbrowser can fit in it), then appears the webbrowser with the Facebook page where I can type my login and password. After that, I'm redirected to the page that asks for permissions on my Facebook account, I click on OK. Everything is good so far.
And then comes my problem. I should be redirected to what they call the "LandingPage" in the tutorial, but instead of that I'm redirected to the facebook "login_success" (https://www.facebook.com/connect/login_success.html) which displays "Success" and also a security warning, and then nothing happens anymore...
I thought something in my code was not right so I spend a couple of hours working on it, didn't find anything. So I tried to run the sample application that they provide in the doc of the website, I just modified the Facebook AppID in it (I've put mine), and same thing happened.
I also tried other things that I found on the Nokia Developer Wiki, same thing.
So I think something is wrong with my Facebook Application, but I can't find what it is...
Is anybody could give me some help ? I'm dying here :(
I apologize in advance for my english mistakes, and I wish you a good day !
UPDATE : I finally did it following this tutorial http://developer.nokia.com/Community/Wiki/Integrate_Facebook_to_Your_Windows_Phone_Application
The redirect to "https://www.facebook.com/connect/login_success.html" should contain the accessToken as a url parameter, so if you allow navigating to this url it is indeed a security risk as it exposes the AccessToken. You need to listen for the 'Navigating' event from the WebBrowser control and if the browser is navigating to "https://www.facebook.com/connect/login_success.html" then you need to cancel the navigation and get the AccessToken from the url parameter.
UPDATE:
It looks like FB changed their OAuth login response from ...login_success.html#access_token= to ...login_success.html?#access_token= There is now a "?" character before the "#" character.
I've seen this in a lot of apps in the store recently so it's probably not you doing something wrong but rather a change by Facebook which hasn't yet been reflected in the SDK.
Have you tried using Windows Azure Mobile Services Authentication instead?
See guides at http://www.windowsazure.com/en-us/develop/mobile/how-to-guides/register-for-facebook-authentication/ and http://www.windowsazure.com/en-us/develop/mobile/how-to-guides/register-for-facebook-authentication/ for more information.
I'm using the LoginButton control of the Facebook SDK .NET for WindowsPhone and have the same issue.
I Fix it, downloading the project from github Facebook-WinClient-Sdk and changing the line 186 of FacebookSessionClient class, for this one:
Uri endUri = new Uri("https://m.facebook.com/connect/login_success.html?#access_token");
The team of facebook sdk for .net will be fix this issue for sure, but i have a demo today and need it works!
I need to have a Embedded browser in my WPF application to show web related content. I have decided to go for WPF Browser control, and my fundamental requirement is I should be able to login to home page directly, without asking the user to sign in again in the web application (Single Sign on). I am able to navigate to the page through the WebBrowser.Navigate() method, but I am not able to automatically log in. I have tried WebBrowser.Navigate(url, null, null, authHdr); but of no use. It is directing me to login to the web site. I have also checked something that is possible through Awesomium but didn't find any solution as of now. Can anyone help me regarding this?
I'm using the Facebook API Graph (C# & ASP.NET) to try to dynamically post to a Facebook page I created.
Looking at the code samples floating around.. they suggest creating a Facebook App first (which I have done)..
However..
I have 3 different pages I want to post to.. Do I need to create an app for each? (I want to post different things to the 3 pages, not the same posts to each)
I just want messages & links to appear as Wall posts. I'm not bothered about having an 'app' that has 'canvas' that is placed in an IFrame.
Question : So do I still need to write one or more Facebook Apps to post to my 3 different Facebook pages??
Where I am so far.. I can pass in my apps credentials and get back the access_token. But my posts don't appear to be going anywhere.
I'd rather drop the 'facebook application /canvas' approach if possible If I can post directly to a wall (For the above reasons).
Oh, and before you ask. I don't want to post to my Apps Wall page, I want to post to my other pages (Unless I have to post to my Apps Wall page first?).
I'm sure loads of people have the same questions..
Thanks in advance.
-- Lee
You can do this with only one app
You'll need these permissions offline_access, publish_stream,
manage_page
After "me" request in response you should parse active_tokens of pages
you administer
Before you make publish request make sure you set
"_facebook.active_token" to
active_token of page where you want
to publish
I think you need to create the Facebook App, because that's the only way you'll get the set of API keys you need for using the API. I think that's the only reason. It's the same when you're using Facebook only for authentication.
1 - I have 3 different pages I want to post to.. Do I need to create an app for each?
No because there is an option to allow an single app to handle multiple pages.
2 - I just want messages & links to appear as Wall posts. I'm not bothered about having an 'app' that has 'canvas' that is placed in an IFrame.
You can do that surely with the help of their Graph API.
You don't necessarily need a canvas, though keep in mind that's where users will go when they click on the name of your app.
Take a look at the Graph API: http://developers.facebook.com/docs/api, particularly the Publishing section. You want to use /PROFILE_ID/feed, where PROFILE_ID is the id of the page you want to post to.
I am thinking about working with remote data and receive or send data actually in external web sites. exists a large amount of examples in World Wide Web are working. For example: free online web tools like web stats OR Google's AdSense .... .you know in such web services some code will generate for publishers and the publisher put generated code in her BODY of web page document(HTML file) and the system after that will work. we can have count of visits for home pages, count of clicks on advertisements and so on.now this is my question: How such systems Work? and how can I investigate and search about them to find out how to program them? can you suggest me some keywords? Which Titles should I looking for? and which Technologies is relevant to this kind of programming? Exactly I want to find some relevant references to learn and start some experiences on these systems. if my Q is not Clear I will Explain it more if you want...Help me I am confused.
Consider that I am an Programmer want to program such a systems not to use them.
There are a few different ways to track clicks.
Redirection Tracking
One is to link the advertisement (or any link) to a redirection script. You would normally pass it some sort of ID so it knows which URL it should forward to. But before redirecting the user to that page it can first record that click in a database where it can store the users IP, timestamp, browser information, etc. It will then forward the user (without them really knowing) to the specified URL.
Advertisement ---> Redirection Script (records click) ---> Landing Page
Pixel Tracking
Another way to do it is to use pixel tracking. This is where you put a "pixel" or a piece of Javascript code onto the body of a webpage. The pixel is just an image (or a script posing as an image) which will then be requested by the user visiting the page. The tracker which hosts the pixel can record the relevant information by that image request. Some systems will use Javascript instead of an image (or they use both) to track clicks. This may allow them to gain slightly more information using Javascript's functions.
Advertisement ---> Landing Page ---> User requests pixel (records click)
Here is an example of a pixel: <img src="http://tracker.mydomain.com?id=55&type=png" />
I threw in the png at the end because some systems might require a valid image filetype.
Hidden Tracking
If you do not want the user to know what the tracker is you can put code on your landing page to pass data to your tracker. This would be done on the backend (server side) so it is invisible to the user. Essentially you can just "request" the tracker URL while passing relevant data via the GET parameters. The tracker would then record that data with very limited server load on the landing page's server.
Advertisement ---> Landing Page requests tracker URL and concurrently renders page
Your question really isn't clear I'm afraid.
Are you trying to find out information on who uses your site, how many click you get and so one? Something like Google Analytics might be what you are after - take a look here http://www.google.com/analytics/
EDIT: Adding more info in response to comment.
Ah, OK, so you want to know how Google tracks clicks on sites when those sites use Google ads? Well, a full discussion on how Google AdSense works is well beyond me I'm afraid - you'll probably find some useful info on Google itself and on Wikipedia.
In a nutshell, and at a very basic level, Google Ads work by actually directing the click to Google first - if you look at the URL for a Google ad (on this site for example) you will see the URL starts with "http://googleads.g.doubleclick.net..." (Google own doubleclick), the URL also contains a lot of other information which allows Google to detect where the click came from and where to redirect you to see the actual web site being advertised.
Google analytics is slightly different in that it is a small chunk of JavaScript you run in your page, but that too basically reports back to Google that the page was clicked on, when you landed there and how long you spend on a page.
Like I said a full discussion of this is beyond me I'm afraid, sorry.