Wednesday, April 2, 2014

How to add Facebook login function into ASP.NET MVC project?

Step 1: create a Facebook app, and get appid
Step 2: Add following code into login view file

Step 3: Create an action in AccountController
        public ActionResult FacebookLogin(string token)
            WebClient client = new WebClient();
            string JsonResult = client.DownloadString(string.Concat(
                   "", token));

            var serializer = new JavaScriptSerializer();
            dynamic value = serializer.DeserializeObject(JsonResult);
            var model = new RegisterModel()
                Email = value["email"],
                FirstName = value["first_name"],
                LastName = value["last_name"]

            FormsAuthentication.SetAuthCookie(model.Email, true /* createPersistentCookie */);
            return RedirectToAction("Index", "Home");

How to solve problem, Given URL is not allowed by the Application configuration Facebook application error?

Go to
->Your app ->Settings -> Addvanced -> Valid OAuth redirect URIs -> put your login url in here

How to create a web page screenshot by Javascript lib, html2canvas

What Javascript Frameworks are used at

DropzoneJS, an open source library that provides drag'n'drop file uploads with image previews