Error when user login in facebook and redirects to my app

May 21, 2008 at 8:47 AM
This is my scenario:
FaceBook Developer Toolkit 1.6

When I'm logged into a session in Facebook and write my app url ( all works fine.
The problem is when I'm not logged in the system.
I use this code:

Facebook.Components.FacebookService _fbService = new Facebook.Components.FacebookService();

_fbService.ApplicationKey = "YOURKEYHERE";
_fbService.Secret = "YOURSECRETHERE";

_fbService.IsDesktopApplication = false;

string sessionKey = Session"Facebook_session_key" as String;
string userId = Session"Facebook_userId" as String;

string authToken = Request.QueryString"auth_token";

if (String.IsNullOrEmpty(sessionKey))
sessionKey = _fbService.SessionKey;
userId = _fbService.UserId;
if (!String.IsNullOrEmpty(sessionKey))
_fbService.SessionKey = sessionKey;
_fbService.UserId = userId;
else if (!String.IsNullOrEmpty(authToken))
Session"Facebook_session_key" = _fbService.SessionKey;
Session"Facebook_userId" = _fbService.UserId;
Session"Facebook_session_expires" = _fbService.SessionExpires;
Response.Redirect(@"" + _fbService.ApplicationKey + @"&v=1.0");

FaceBook said me that I have to write my username and password, then Facebook redirect me to my Callback url!!!! (http://84.24...../?auth_token=87f9c875....) and I get this two errors: (sometimes one and sometimes second)

Error in this line  ---->     _fbService.CreateSession(authToken);
or error in this line -----> Facebook.Exceptions.FacebookException: Invalid parameter base.Page_Load(sender, e);

when this happen If I write my app (http://apps.face.../myapp) url (now I'm logged in Facebook) all works.

Anyone Knows what's the problem??

thank you in advance.