I am trying to authenticate my users using their facebook ids. For that I have their facebook id. saved in my database at the time of registration. I am using javascript API of facebook for that and it is working fine brings back user to my site with the user basci information where from .aspx page on success i am using jQuery ajax call
FB.Event.subscribe('auth.statusChange', function (response) {
if (response.authResponse) { FB.api('/me?email?dob', function (me) { if (me.name) {
emid = me.email;
$.ajax({
url: 'index.aspx/checkuser',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({ eid: emid }),
}
})
});
the above code is on my masterpage.aspx to a webMethod in my code behind which is a static method
[WebMethod]
public static void checkuser(string eid)
{
checkFBDB objChk = new checkFBDB();
objChk.isFBIDExists(eid);
}
this code is on the content page index.aspx and within that method i am calling a class function by creating class object public class checkFBDB : System.Web.UI.Page {
public void isFBIDExists(string fbID)
{
string cnString = string.Empty;
cnString = ConfigurationManager.ConnectionStrings["connectionString"].ToString();
SqlDataReader dR = SqlHelper.ExecuteReader(cnString,
CommandType.Text, "SELECT * FROM smsUsers WHERE fbA='" + fbID + "' ");
if (dR.Read())
{
Session["userName"] = dR["userName"].ToString();
Session["smsCredit"] = int.Parse(dR["SMSCredit"].ToString());
Session["sender"] = dR["FName"].ToString();
Session["userMob"] = dR["MobileNo"].ToString();
HttpContext.Current.Server.Transfer("AuthenticatedForms/sendMessage.aspx");
}
else
{
HttpContext.Current.Server.Transfer("~/mapFBID.aspx",true);
}
}
}
which opens connections with the database and verifies if the user exists in our DB with the provided facebook id then "HttpContext.Current.Server.Transfer("AuthenticatedForms/sendMessage.aspx");" i am using this statement but the problem is if i use the same statement from a nomral page it transfers fine but from this code class it transfers performs all operations i have seen in debug mode but comes back to the page from where web method has been called which is calling this code class for the transfering of control. I am using master pages. Visual Studio 2010, back end is SQL SERVER 2000. Following is my Code. Thank You in advance for any assistance.