Setting ApplicationKey and SecretKey in Faceboot.Net library for FaceBook application

by Viper 12. January 2009 13:11

There are 2 unique pieces of information that are used in development of FaceBook application, Application Key and Secret key. When you are using Facebook.Net development kit for building FaceBook applications in ASP.Net, these 2 values are specified in configuration file under facebook section. If you do not specify these values in configuration file, your application will throw InvalidOperationException. Facebook.Net library tries to verify these 2 pieces of infomation very early in the stage during PagePreLoad event. If you don't feel comfortable leaving this information in configuration file and want to set it programatically, you can provide override method for OnInit in your page and set the values there.


protected override void OnInit(EventArgs e)
{
  base.OnInit(e);
  if (string.IsNullOrEmpty(MyFaceBookApp.Secret))
  {
     MyFaceBookApp.Secret = "xxxxxxxxxxxxxxxxxxxxxxx";
  }
  if (string.IsNullOrEmpty(MyFaceBookApp.ApplicationKey))
  {
     MyFaceBookApp.ApplicationKey = "xxxxxxxxxxxxxxxxxxxxxxxx";
  }
}

Give your advice to big bosses and make money

Views: 1563

Tags:

ASP.Net | FaceBook

Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.1.7
Theme by Naveen Kohli

By Categories