Facebook tab app - alternative landing page for "liked" users - asp.net

I have developed one Facebook Application.
In facebook, page tab url I have specified a landing url, it is landing safely no issues.
Now I want if I click on like button, it should call another landing page.
What can be best solution for this ?

What you will have to do is read the signed_request passed to your tab application.
The signed_request will contain information on whether or not the current user "liked" the page that the app is on. Once you know if the user "liked" the page or not, in the even that s/he has already liked the page, you can redirect them to whatever URL you wish.
I see you have specified asp.net of which I have no knowledge, but I can tell you that the signed_request is passed to your application as a POST request. From there you need to parse the signed request and then you can read it's contents.
Here is a simple JavaScript redirect (in PHP) -
echo "<script language=javascript>";
echo "window.location.href ='".$url."';";
echo "</script>";

Related

Requiring Sign-In For Shortcode-Based Plugin

Developing a plugin for personal use that adds data-driven content to WordPress pages through shortcodes. In the current implementation, the shortcode php checks if the visitor is authorized (specifically, if the visitor is me), displays the data-driven content if authorized, and displays a message if not.
Instead of a message, I'd like to do an auth_redirect. But by the time my shortcode is parsed, WordPress has already begun sending content to the client, so the redirect doesn't happen.
Is there a (simple) way to get auth_redirect behavior from shortcodes? For instance, can I somehow pass the return URL to the wp-login page? Or do the authorization check earlier in the page processing?
It's much simpler than I thought: I can simply href to the login page and pass the current page's url as parameter:
esc_url(wp_login_url( get_permalink()))
Hyperlinking to this sends me to the wp login page, and the get_permalink parameter ensures I return to the calling page after login.

Redirection not working with JQuery Mobile

I am running a DNN7.1 website. I have a regular website. I added a page which acts as login page for mobile users. I am using JQuery Mobile 1.3.2 on the mobile pages including this mobile login page. If the user navigates to that page and enters username and password, it works correctly and redirects them to the correct page sent on the url using a querystring, example:
http://localhost/Mobilelogin?url=http://localhost/somePage
it correctly redirects to
http://localhost/somePage
Now I want to add capability where user can directly send his username and password along with the url that he wants to navigate, the login page should authenticate using the username and password provided and once successful redirect it to the url (using asp.net Response.Redirect method), in the format
http://localhost/Mobilelogin?u=username&p=password&url=http://localhost/somePage
The issue is, it works fine if the user is not logged in but if he is already logged in and then uses the same url, (which has username and password) redirection doesn't work. I tried disabling the ajax using following code, as I read redirection and JQM doesn't work well.
$(document).on("mobileinit", function () {
$.extend($.mobile, {
linkBindingEnabled: false,
ajaxEnabled: false
});
});
But it still is not working. Can anyone please let me know what I need to do to make this work.
I tried debugging the login module, which is written in c#, when the user enters the url when not logged in, it calls the page load and hits the break point but when logged in and enters the url the break point is never hit. It looks like browser is not even contacting the server. I am new to JQM, I thought disabling the ajax globally will always hit the server to get the information. Is that not how it works? How can I make the redirection work in my case. Any help is greatly appreciated.
You need to be aware that by default, jQuery Mobile uses AJAX to load page content and does not "redirect" as per normal.
You should read the FAQ's as these provide useful information: -
http://view.jquerymobile.com/1.3.2/dist/demos/faq/
Specifically: -
.. it will only inject the contents of the response's body element (or
more specifically the data-role="page" element, if it's provided),
meaning nothing in the head of the page will be used
http://view.jquerymobile.com/1.3.2/dist/demos/faq/scripts-and-styles-not-loading.html
This might explain why your script doesn't execute, as if it's in the <head> it's not being loaded.

Return URL concept in ASP.NET

My requirement is this. whenever i would not be login in my site then never access a web page. but the url added after the login page url means (return url) and after successful login into my site the page redirect to same page which i have to access and entered into address bar.
Example: i have to access page http://localhost:14334/User/userdetail.aspx without login. the page returns to me on http://localhost:14334/Login.aspx. but i want that the page returns to me on http://localhost:14334/Login.aspx?ReturnUrl=%2fUser%2fuserdetail.aspx
Sounds like all you are missing is the call to redirect:
FormsAuthentication.RedirectFromLoginPage(UsernameTextbox.Text, NotPublicCheckBox.Checked);
See this for more information - http://msdn.microsoft.com/en-us/library/ka5ffkce.aspx
The return URL in the ASP.NET login page returns to the location upon a successful login, if the default ASP.NET template is not modified.

Global routing parameter in ASP.NET MVC

When a user clicks on a link, I want to log some information. I can't do an AJAX request because if they clicked on a link, the page will unload (since they're going to a new page), and I don't want to force them to stay on the page until a synchronous event finishes.
So one idea I had was to add a parameter to the url. I.e. the urls would be actual/action?actualParams&infoIWantToLog=data. Then I could strip off the info I want to log, log that, and then pass off their URL to the action which they actually wanted to go to. Is this possible to do with MVC routing?
Typically tracking URLs send the user to a specific page (or action, in this case), say, /Track, and then pass the parameters to log (including the URL to send the user to) through the querystring.
For instance, go to Google and search on a term. Right click on a result and copy the URL. Now paste it into Notepad. You'll see that it's not a direct link to the search result, but rather to a Google tracking page. For instance, when I search for asp.net and click on the first result (for www.asp.net), this is the actual URL Google sends me to:
http://www.google.com/url?sa=t&source=web&cd=2&ved=0CDcQFjAB&url=http%3A%2F%2Fwww.asp.net%2Fget-started&rct=j&q=asp.net&ei=BauTTIuCDIaWsgOHgo3ACg&usg=AFQjCNGR6cOBKtUWIKZs9jnpz0vYRDu_EA&sig2=r2q31zniuxHQ4Y6BIoudow&cad=rja
That page logs my click and then redirects me to the www.asp.net website.
Your Track action would do the same thing. You'd create a Track controller with an Index action and then in there you'd parse the querystring, log the information, and then return a RedirectResult to the URL you want to send the user.
Make sense?

Images in IFRAME no longer showing after I log out of Flickr?

I have a iframe window which displays user's flickr images. I use the flickr.photos.search api to download the user's image from flickr. This works great when the user is logged into flickr.
But when I explicitly log off the user from flickr and the yahoo network and then attempt to download the flickr images, I get redirected to www.yahoo.com in a full browser window (not in my iframe).
If I remember correctly, I did not have this issue when I was not using iframes and I was being redirected to the yahoo login screen.
Any suggestions?
To elaborate, this URI - http://www.flickr.com/services/api/auth.howto.web.html, lists the below step -
Create an auth handler
When users follow your login url, they are directed to a page on flickr.com which asks them if they want to authorize your application. This page displays your application title and description along with the logo, if you uploaded one.
When the user accepts the request, they are sent back to the Callback URL you defined in step 2. The URL will have a frob parameter added to it. For example, if your Callback URL was http://test.com/auth.php then the user might be redirected to http://test.com/auth.php?frob=185-837403740 (The frob value in this example is '185-837403740').
This does not happen when I am in my iframe window but it does happen in my full browser window.
I posted the above question in the flickr forums and I received a response which said this cannot be done in iframes. So, I would need to rejig my UI to achieve this.

Resources