首页 > 解决方案 > Window 10 1 月 14 日更新后重定向框架内的表单身份验证问题

问题描述

我在我的 asp.net 应用程序中使用表单身份验证,我的应用程序可以用作打孔,其他应用程序可以使用我的应用程序进行先前的身份验证,但是,它在收到 Microsoft 的 Windows 10 更新后突然停止工作。

我的目录应用程序过去是在框架中打开的,流程是:在收到打孔请求后,请求正在被验证、验证,然后系统将使用 response.redirect 将其重定向到目录主页。但是,我们在重定向到主页时失去了控制并登陆了表单身份验证登录 url。

下面是验证打孔请求并重定向到主页的示例代码(即 default.aspx)

private void AuthenticatePunchoutUser()
{   
    String punchoutid = Request["punchout"].ToString(); 

    //Create a PunchoutDB object and Authenticate the punchout request
    ePlus.Catalog.DataTypes.cXMLPunchout oPunchout = null;
    try
    {
        ePlus.Catalog.DataTypes.cXMLPunchoutDB oPunchoutDB = new ePlus.Catalog.DataTypes.cXMLPunchoutDB();
        oPunchout = oPunchoutDB.AuthenticatePunchout(punchoutid);
    }
    catch (System.Exception e2)
    {           
        ePlus.Data.Global.Log.Error("Error authenticating punchout session with punchoutid= " + punchoutid, e2);
        throw;
    }   
    //Log that the user was authenticated
    ePlus.Data.Global.Log.Info("Authenticated punchout User " + strUserName);   

    //Tell Forms Authentication that the user is valid 
    System.Web.Security.FormsAuthentication.SetAuthCookie(oUser.Login, false);

    String strRedirect = "~/Secure/Default.aspx";

    //Redirect
    this.Page.Response.Redirect(strRedirect);                        
}

在 response.redirect 上,应用程序重定向到登录页面(即表单身份验证登录 url)。

标签: asp.netwindows-10frameforms-authenticationresponse.redirect

解决方案


推荐阅读