【问题标题】:Posting data from one asp.net page to another将数据从一个 asp.net 页面发布到另一个页面
【发布时间】:2009-05-18 22:22:05
【问题描述】:

好的,我已经对此进行了足够的研究,但找不到解决方案。它从应用程序的一页到应用程序的另一页。因为我要发送用户名和密码,所以我不能将它作为“getT”发送,所以我需要做一个“post”。不过我会使用 ssl - 不确定这是否有帮助.. 所以我不能在不同的应用程序上使用会话,并且使用像databsae这样的共享会话会导致性能下降 此外,一旦用户单击源页面上的链接,我需要进行一些后期处理,然后想要发布到其他页面,因此使用表单和内容将无法正常工作..

任何帮助

fyi:我想要实现的是,当一个人登录应用程序 A 时,他们点击了一些链接,我没有进行一些处理并希望将它们转移到应用程序 B,他们不必重新登录应用程序 B,而是自动登录登录..

【问题讨论】:

    标签: c# asp.net forms post


    【解决方案1】:

    我们使用 Global.asax 来做与您描述的相同的事情。假设两个 Web 应用程序使用相同的业务域。您可以使用以下内容在我们的业务域中设置登录用户。然后,您可以使用该属性的存在来知道不要在您的第二个 Web 应用上再次要求登录。

        /// <summary>
        ///     Event fires when an HTTP request is made to the application.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Application_PreRequestHandlerExecute(object sender, EventArgs e)
        {
            // If we don't have a logged in user.
            if (<BusinessDomain>.Constants.LoggedInUserID == null)
            {
                // Ensure that Context.Handler for this particular HTTP request implements an interface that uses a Session State.
                if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState)
                {
                    if (Session != null)
                    {
                        // Set the currently logged in user in our Business Domain.
                        if ((Guid)Session["UserID"] != Guid.Empty)
                        {
                            <BusinessDomain>.Constants.LoggedInUserID = Session["UserID"];
                        }
                    }
                }
            }
        }
    

    【讨论】:

      【解决方案2】:

      也许不是最好的解决方案,但您可以使用 cookie。

      【讨论】:

      • 假设这些是同一根目录下的虚拟应用程序,然后执行此操作,但要验证 cookie 路径是否引用了外部应用程序。否则您将无法共享它们。
      【解决方案3】:

      我认为您正在寻找Single Site Login 解决方案。

      【讨论】:

        【解决方案4】:

        同意 Thomas 的观点,听起来是为单点登录解决方案量身定制的。使用单点登录的多个 Web 应用程序,因此一旦您登录一个应用程序,您就登录了所有引用成员资格提供程序的应用程序..

        http://weblogs.asp.net/scottgu/archive/2006/05/07/ASP.NET-2.0-Membership-and-Roles-Tutorial-Series.aspx

        http://dotnetslackers.com/ASP_NET/re-29031_ASP_NET_2_0_Implementing_Single_Sign_On_SSO_with_Membership_API.aspx

        希望对你有帮助

        【讨论】:

          猜你喜欢
          • 2016-04-05
          • 1970-01-01
          • 1970-01-01
          • 2012-06-24
          • 2013-01-24
          • 1970-01-01
          • 2020-08-16
          • 2023-03-24
          • 1970-01-01
          相关资源
          最近更新 更多