【发布时间】:2014-05-19 03:38:18
【问题描述】:
我想将 FB 响应从客户端传递到服务器端(代码隐藏)
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function (response) {
$.post('http://localhost:4741/Default.aspx',
{ fbid: response.id, firstname: response.first_name, lastname: response.last_name, email: response.email, bday: response.birthday },
function (result) {
});
console.log('Good to see you, ' + response.id + response.name + response.id + response.email + response.gender + response.birthday + '.');
});
}
我想获取页面加载中的值和过程
protected void Page_Load(object sender, EventArgs e)
{
var fbid = Request.Form["fbid"];
var fname = Request.Form["firstname"];
var lname = Request.Form["lastname"];
var email = Request.Form["email"];
var bday = Request.Form["bday"];
if (!Page.IsPostBack)
{
if (fbid != null)
{
if (CheckFBLogin(fbid.ToString()) == true)
{
Response.Redirect("Users.aspx");
}
else
{
Response.Redirect("Register.aspx");
}
}
}
}
CheckFBLogin(fbid.ToString()) 是位于页面后面相同代码中的函数。但是当通过 Response.Redirect("Register.aspx",true);没有任何事情发生。它将保留在同一页面中。
应该解决什么问题?
【问题讨论】:
-
所以如果 CheckFBLogin 成功,你重定向到 Register.aspx,如果失败 - 你做同样的事情吗?这里有错字吗?
-
好的,我认为有错字,但是 response.redirect 都不起作用
标签: c# jquery asp.net redirect post