奇怪的错误-“对象已移至此处". [英] Strange Error - "Object moved to here."

查看:65
本文介绍了奇怪的错误-“对象已移至此处".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到奇怪的错误对象已移至此处".当我尝试登录自己创建的网站时,在空白的白页上显示.它在本地工作正常,但是当我将其部署到测试或生产服务器时却无法正常工作.我没有做任何奇怪的事情,只是在辅助函数中使用基本的身份验证代码,如下所示...

I get the strange error "Object moved to here." on a blank white page when I try to login on a site I created. It works fine locally but not when I deploy it to the test or production server. I am not doing anything odd, just using basic authentication code in a helper function as follows...

public static bool AuthenticateUser(string Username, string Password, bool PersistLogin, string RedirectionURL)
    {
        if (Membership.ValidateUser(Username, Password))
        {
            FormsAuthentication.SetAuthCookie(Username, PersistLogin);                
            HttpContext.Current.Response.Redirect(RedirectionURL,true);
            return true;
        }
        else
            return false;
    }

推荐答案

出于这种原因,您需要在此上下文中使用RedirectFromLoginPage.

You need to use RedirectFromLoginPage in this context... for exactly this reason.

如果您立即结束响应处理,则可能无法设置auth cookie.

If you end response processing immediately, the auth cookie may not get set.

这篇关于奇怪的错误-“对象已移至此处".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆