简体   繁体   中英

Posting data from one asp.net page to another

Ok I have done enough research on it but cant find the solution. Its from one page of a application to another page of application. Since I would be sending in username and password i cant send it as "getT" so i need to do a "post". I will be using ssl though - not sure if that helps.. so i cant use sessions as its on different apps and using those shared sessions like databsae is performance killing Also once the user clicks the link on the source page, i need to do some post processing and then want to post to the other page so using the form and stuff wont work..

any help

fyi: What I am trying to achieve is that a person when logs in app A, they click some link, i dont some processing and want to transfer them to app B where they dont have to relogin in app B but instead automatically get logged in..

We use Global.asax to do much the same thing you are describing. Assuming both web apps use the same business domain. You can use the following to set a logged in user in our business domain. You can then use the presence of that property to know not to ask for login again on your second Web App.

    /// <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"];
                    }
                }
            }
        }
    }

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

我认为您正在寻找单一站点登录解决方案。

Agree with Thomas, sounds tailor made for the single sign on solution. Multiple web apps using a single sign on, so once you log in on one app you logged in on all that reference the membership provider..

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

hope that helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM