Running Canvas app in a Tab - asp.net

This is my first Facebook app and I'm on quite a tight deadline so forgive me if any of this is a dumb question.
I've set up a Canvas app, I've got it to authenticate by passing the parameters to the facebook URL:
https://www.facebook.com/dialog/oauth?client_id=1234&redirect_uri=MY_APP_URI
I can then get the user_id and name of the user, which for this particular app is all I need. It runs fine in the Canvas page.
Problem is I can't get it to run in a tab, it always redirects to the Canvas, which is not what I want - I need it to run within the context of my client's Facebook page. I've been trying to find examples of setting it up but everything seems to be out of date compared to what I'm seeing in the App settings.
My settings at the moment are:
App on Facebook
Canvas URL: http://localhost/facebook/
Canvas Page: http://apps.facebook.com/MYAPP
Page Tab
Page Tab Name: My test app
Page Tab URL: http://localhost/facebook/
I presume I'm missing something obvious, so if someone can advise I'd be grateful. For what it's worth I'm using .Net webforms and have the C# SDK installed, but don't think I'll need to really use it for this example.
EDITED TO ADD
I'm sure its to do with the authorization - I've followed the guide here developers.facebook.com/docs/appsonfacebook/tutorial on how to redirect the page back with the authorization payload, but obviously doing that has kicked it out of the tab and into the main Canvas again. I need to to stay where it is, if such a thing is possible.

localhost points from your local machine to itself. Facebook does not know what localhost relates to and cannot load the app. You need to make your app accessible from outside of your machine.

It was the fact that I was still redirecting the url, when you run in a tab you don't need to redirect to another url to get the user data, it's just there waiting.

Related

Can I get the browsersync proxy to not update a particular URL?

Details:
I create virtual hosts for development like http://project.client.dev and then use browsersync for live reloading and whatnot, which creates a proxy at http://localhost:3000. This causes all URLs on the page to be written to http://localhost:3000, which in 99% of cases is exactly what I want, but sometimes I want to link to that original http://project.client.dev path instead.
Question:
Is it possible to have browsersync not update just particular URLs? Like, add a class of do-not-update or something and have those stay http://project.client.dev instead of being updated to http://localhost:3000?
Use Case:
I build WordPress websites. When I'm clicking around the site's front-end I want those http://localhost:300 addresses so live reloading occurs. On the back-end however, I don't want those paths ending up in the database or, worse yet, browsersync reloading my admin screens while I'm editing content. Typically I just open one tab on the front-end and one on the back-end using the respective domains, but I'd like to add an in-development link to the footer that says "edit page ID 123" and opens the current front-end page up on the back-end for editing; problem is, it opens the http://localhost:3000 version of the back-end and I need to manually update the URL every time (provided I remember to do so).
I think is it not possible at this moment to exclude some URLs. But have a look at the documentation : https://www.browsersync.io/docs/options

"http://localhost/" is being automatically added to https urls

As the title suggests, http://localhost/mywebapp is being automatically added to urls within my application.
User clicks an https hyperlink, but instead of browsing to
https://correcturl.something.com
it goes to http://localhost/mywebapp/https://correcturl.something.com
ie the localhost part is being automatically added. I'm sure there is an IIS setting that we are missing here.
It might not be IIS. If you're forming your URLs improperly, I'm pretty sure the browser will handle redirect to "current url" + "redirecting url".
example:
if you execute the following in a javascript console, you will not get redirected.
window.location.href = "/http://google.com";
Running that off stackoverflow page sends me to https://stackoverflow.com/http://google.com
which is incorrect.
I'm assuming that if you're testing urls in some dev environment locally, you'll produce a similar result against localhost. I can't give you a better answer without more information, however I would begin by looking for something in your app similar to what I described.

ASP.NET 2.0 website white screen of death

I am encountering a strange issue which is only affecting several users from an over 7000 user-base. Having searched the web for several hours to no avail, I'm hoping someone here can help!
I have an ASP.NET 2.0 website and when certain users try to access the home page (Default.aspx) they receive a white screen with no content loaded. This issue is occurring both in production environment and if I run the solution against a copy of production data. So I am able to replicate the exact same issue when I pseudo the problematic users.
When debugging the application in VS2005 and set a breakpoint in the code behind in the Default.aspx, the breakpoints are fired/hit so I know the request is working. The problem seems to be once the server has finished serving the request, the response back to the client/browser is empty.
Here's another strange thing I've noticed. If I alter the HTML in Default.aspx by adding a new white line or whitespace, the page will load fine for the same set of users. I thought I had resolved the issue with this fix but unfortunately the white screen issue just manifests itself once again.
Within Default.aspx, there's some AJAX requests using jQuery .load function but this can't be the issue because this functionality exists for every user of the site. The only variable is the amount of content returned within this request can vary depending on the user. But why would it resolve itself when I put a whitespace or whiteline in the page and then manifest itself hours later?
Another thing to note is it's only Default.aspx that is encountering this issue. If I browse to another page by typing in a page in the address bar, the page is served OK.
Hope someone can point me in the right direction on how I can debug or even resolve the issue.
It sounds like your ajax is the cause but without seeing some code, it's difficult to know why.
It could be a timeout, or an error that is preventing the ajax from completing it's function.
You need to use a tool like Charles or Fiddler to debug what is happening whilst the page loads whilst logged in as these users. In a nutshell, a tool like Charles will display all the detail surrounding requests made and responses served to the browser, including any failed responses.
I think it has to do with http headers, caching or encoding. But I cannot tell more without code.
Is output caching enabled for this page?
Can you give us the raw http headers for both the request and response?
If a white screen appears, will it be fixed by pressing ctrl+f5?

can not add an iframe tab

Ok, so I've done it a hundred time or more, but today - got a new problem.
created a simple html page with an image
uploaded to a server
opened the page in the browser - no problem, all works fine.
created a new app, selected "tab" and insert the tab name, the http and https url
Tried to view the app and got "The page you requested was not found"
I've checked with other iframe tabs that I've built, they all configured the same, yet the new one - fails to load.
I've seen that the interface has changed a bit, Its not unusual that Facebook breaks things from time to time but maybe I'm missing something?
Edit: also, from some reason I don't have the "View App Profile Page" on that app
They changed some things around, profile pages are no longer being made. Check this out http://developers.facebook.com/blog/post/611/
Although I'm still having problems with getting errors when I try to add the app

Chrome returns "Bad Request - Request Too Long" when navigating to local IIS Express

I have a web application that runs perfectly fine when I use the Visual Studio 2010 development server (Cassini). However when I try to use IIS Express to host the site Chrome just displays a "Bad Request - Request Too Long" error. The IIS Express site does display in other browsers (FireFox and IE9) so I'm kind of confused. The error occurs in Chrome when I try request pages in my application or even basic resources like an image, so I don't think it is an issue with URL rewriting or routing.
Just to see if the problem was somehow a result of my site's code, I created a new MVC3 website and tried running that. This worked in the VS development server, but once again produced the "Bad Request" error when running under IIS Express.
I am about to start testing the site using some mobile devices so I need to get this running under IIS. Any suggestions would be greatly appreciated.
EDIT:
The root url of the site (http://localhost:50650/) is being requested using GET. I am currently using Chrome v12.0.742.112.
I get this all the time ONLY in Chrome and I have to clear browsing data to fix it.
Wrench > Tools > Clear Browsing Data
Check the following:
Clear browsing history
Clear download history
Empty the cache
Delete cookies and other site data
Then click "Clear Browsing Data" button and refresh your page.
UPDATE:
I figured out that it has to do with writing too many cookies to the browser and that if you just close all instances of Chrome, the error goes away for a while. To prevent it, you'll need to clear out your cookies programmatically.
Instead of clearing all the cookies, just do the following:
Right click the lock in the address bar area (see picture below)
Under cookies there is a link saying how many cookies are used
Click that link
Remove all cookies in there (or just the troublesome if you can identify them)
Problem gone
This error is caused by a corrupt cookie for the website you are trying to view, so to clear it all you need to do is clear the bad cookie(s) for that website.
In Chrome, go to...
chrome://settings/cookies
(Or manually go to Settings->Advanced Settings->Privacy->Content->All Cookies and Site data)
From there, you can search for cookies that match the site you are having problems on. Finally, click "remove all" for the matching cookies.
The problem is usually that the site in question has accumulated too many cookies or created cookies which are too large, making the HTTP headers swell beyond the allowed maximum.
One-time work-around
As has been mentioned, you can go to Settings|Advanced|Content Settings|All Cookies and Site Data, search for the site in question, and delete the cookies using the X button on the right. This reduces the header size of the HTTP request when contacting the site.
Long-term work-around
In addition to removing them one-time, however, you can prevent further problems with heavy cookie sites by going to Settings|Advanced|Content Settings|Manage Exceptions, and add the base site url (e.g. "msdn.microsoft.*" without the quotes) and select Behavior as "Clear on Exit". You might have to login more often to these sites, but this should prevent the problem.
I encountered this problem when using ADB2C login from ASP.NET WebApp. In Firefox you can do similar use case to delete related coockies and problem is gone for a while. Click on HTTPS (i) lock icon with, select ">" button on the right, select More information, select Security tab, click on View Cookies and click on Remove All. Done 4 a while.
If Above methods didn't work then enter
chrome://settings/resetProfileSettings
and Click on Reset Settings
This will reset your startup page, new tab page, search engine, and pinned tabs. It will also disable all extensions and clear temporary data like cookies. Your bookmarks, history and saved passwords will not be cleared.

Resources