C# 响应。重定向asp&x27;$post jquery之后无法工作

C# 响应。重定向asp&x27;$post jquery之后无法工作,c#,jquery,asp.net,facebook,C#,Jquery,Asp.net,Facebook,我通过将值发布到currentpage来传递Facebook Response function testAPI() { console.log('Welcome! Fetching your information.... '); FB.api('/me', function (response) { $.post('http://localhost:50790/TestPage.aspx',

我通过将值发布到currentpage来传递Facebook Response

 function testAPI() {
            console.log('Welcome!  Fetching your information.... ');
            FB.api('/me', function (response) {

                $.post('http://localhost:50790/TestPage.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.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)
                {

                    CheckFBLogin(fbid.ToString());
                }
            }

        }
我的测试是在
CheckFBLogin
上进行的,如果结果正确,它会让用户登录到网站,否则它应该重定向到其他页面/注册页面

 public void CheckFBLogin(string Fbid)
        {


            CustomerSelfCareSoapClient service = new CustomerSelfCareSoapClient();
            service.ClientCredentials.UserName.UserName = _Username;
            service.ClientCredentials.UserName.Password = _Password;
            GResult result = service.CheckFBLogin(Fbid.ToString(), "");
            if (result != null)
            {
                if (result.Code == 100)
                {
                    //login
                }
                else
                {

                    Response.Redirect("~/callback.aspx", true);

                }
            }
        } 

我不知道会发生什么,我通常会这样做来检查登录名,但纯粹是asp和c。我知道为什么页面不会重定向吗?

我可以用Mono复制这种行为。在我的系统上,问题是jquery$post()方法实际上启用了代码隐藏中的Page.IsPostBack属性,因此如果(!Page.IsPostBack){}条件中的所有逻辑都无法运行


我的建议是在jquery旁边使用ASP.NET的[WebMethod]属性。如果要执行大量异步客户端JSON调用,你可以考虑ASP.NET的MVC实现,如果你的项目的范围允许的话。

你是否调试过你的代码来查看代码中的if语句,如果if语句实际上调用了响应?重定向?也尝试添加一些异常处理-ReaveS.ReDead会经常失败,因为一些数据已经被刷新了。客户端。@MaxOvrdrv是,当我调试它传递给响应重定向的代码时code@steve我还没有试过那本书,恐怕这本书只是好奇
Page.IsPostBack
。我希望我能将项目重新创建到MVC,但这需要时间,所以我想我会使用
[WebMethod]
到我的asp