0

一个新的弹出窗口打开,但它被重定向到登录页面,并且基本页面也因显示不正确的密码而无法登录。要求:我们需要在浏览器上没有任何返回按钮的登录后弹出窗口。

<asp:Content ID="LoginContent" ContentPlaceHolderID="LoginContent" runat="server">
      <asp:UpdatePanel ID="LoginUpdatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel Width="100%" runat="server" ID="LoginPanel" HorizontalAlign="Center" DefaultButton="MainLogin$LoginButton">
                <asp:Label ID="LoginMessageValue" runat="server"></asp:Label>
                <asp:Login RememberMeSet="false" ID="MainLogin" OnLoggedIn="MainLogin_LoggedIN"  OnAuthenticate="Login_Click" runat="server" SkinID="standardLoginObject" EnableTheming="True"
                  TextBoxStyle-Width="150px" DisplayRememberMe="false">
                </asp:Login>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

代码背后:

Protected Sub Login_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        'OnAuthenticate = "Login_Click"
        ' ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "error", "window.open('~/workflow/Worklist2.aspx', 'mywindow', 'status=1,toolbar=0');", True)
        Try
            Common.UserObject = System.Web.Security.Membership.GetUser(MainLogin.UserName)

            Dim _userID As Integer = Common.UserObject.ProviderUserKey
            Common.InitializeSession(_userID, nameSpaceURI)
            Dim _role() As String = System.Web.Security.Roles.GetRolesForUser(Common.UserObject.UserName)
            If _role.Length = 0 Then
                Common.ClearSession()
                Response.Redirect(ConfigurationManager.AppSettings("LoginPath"), False)
                'MainLogin.FailureText = "Please contact the customer service to review your account setup."
                'ClientScript.RegisterClientScriptBlock(Page.GetType, "Error", "alert('Please contact the customer service to review your account setup.')", True)
            End If
            ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "success", "window.open('../workflow.aspx', 'mywindow', 'status=1,toolbar=0'); window.resizeTo(screen.availWidth,screen.availHeight); window.moveTo(0,0); ", True)
        Catch ex As Exception
            SaveException(ex)
        End Try
    End Sub
4

1 回答 1

0

我认为您真正的问题是您试图显示一个错误页面,该页面还要求用户通过身份验证才能看到它。

您应该将错误页面移动到公开可见的位置。

您可以在 web.config 中指定此行为:

<configuration>
   <location path="~/errorpage.aspx">
      <system.web>
         <authorization>
            <allow users="?"/>
         </authorization>
      </system.web>
   </location>
</configuration>
于 2012-04-19T15:54:23.497 回答