Classic ASP and Facebook Connect

September 3, 2010

I wrote a simple Classic ASP game called Never Ending Maze back in 1998. It was in fact the first thing I wrote in ASP (VBScript) and how I learned how to program in VBScript. Anyhow in order to get facebook to interface with it I simply used the “Connect” button. Here’s how the HTML code looks:


[html]<a href=""><img id="fb_login_image" src="images/Connect_with_facebook_iphone.png" alt="Connect"/></a>[/html]

After that hard bit of code was done, I wrote the simple fb_connect.asp page. This page handles the request, and communicates back to facebook to get the cookie. Once it has the cookie it will automatically redirect you to the /login.asp page. If it doesn’t get the cookie, then it will refresh the page until it finally does. Do note that if you disable third party cookies this may not work:


Dim fb_uid,ApiKey
fb_uid = ""
ApiKey = "183f81e6ef8024631ed9c91feb9e0d84"
fb_uid = Request.Cookies(ApiKey & "_user")
Session("fb_uid") = fb_uid
If IsNumeric(fb_uid) And Len(fb_uid) > 2 AND Len(Request.Cookies(ApiKey & "_session_key"))>2 Then
Response.Redirect "/login.asp"
End If
<html xmlns="" xmlns:fb="">
<head runat="server">
<title>Never Ending Maze – Loading Facebook Connect…</title>
function refresh()
<meta http-equiv="refresh" content="2">
<body style="background-color:#000000;">
<form id="form1" runat="server">
<script src="" type="text/javascript"></script>
<script type="text/javascript">
FB.init("183f81e6ef8024631ed9c91feb9e0d84", "xd_receiver.htm");
loading …

It’s as easy as that to make a classic ASP page work with Facebook’s Connect.

+1 this post if it helped you!

2 comments on “Classic ASP and Facebook Connect

  1. reginald lycke on said:

    Greetings from Belgium.
    i want lauch a contest where people have to like a fanpage to participate at the contest. After the like a form with the name, firstname and e-amiladress most be send to e-mailadres and stored i a accesdatabase.
    can you help with that?

Leave a Reply