重定向其他页面,然后首页登录后,在asp.net



我创建了一个小的windows应用程序,用于登录一个名为ebridge的web应用程序。这是我们公司的内部网站。我已经写了这个代码在我的按钮点击事件登录这个网站:

<>之前private void button1_Click(对象发送者,EventArgs e){System.Diagnostics.Process.Start (" https://app.ebridge-solutions.com/ebridge/3.0/Default.aspx?user=Ebridge&password=test&filecabinet=E集团");} 之前

登录成功。但我的问题是,我需要重定向一些其他页面即(https://s2.ebridge-solutions.com/ebridge/3.0/retrieve/retrieve.aspx)不是家。登录后的Aspx页面。有任何想法或代码来克服这个问题吗?

最好的方法(可能也是唯一的方法)是在页面(https://app.ebridge-solutions.com/ebridge/3.0/Default.aspx)本身添加一些逻辑/代码。

从winform

System.Diagnostics.Process.Start("https://app.ebridge-solutions.com/ebridge/3.0/Default.aspx?user=Ebridge&password=test&filecabinet=E Group&redirect=true");

注意,我在查询字符串的末尾添加了redirect=true

为默认值。aspx Page_Load

string redirect= Request.QueryString["redirect"];

string redirect将作为标志。如果为真,并且登录成功。页面将重定向到目标URL。

(default.aspx)的示例代码:
    protected void Page_Load(object sender, EventArgs e)
        {
            string redirect= Request.QueryString["redirect"];
            string user= Request.QueryString["user"];
            string password= Request.QueryString["password"];
            if (authorizeUserAndReturnStatus(user,password)&&redirect=="true")  //assuming authorizing return bool, indicating the status of login (true or false) 
               {
                  Response.Redirect("https://s2.ebridge-solutions.com/ebridge/3.0/retrieve/retrieve.aspx");
               }
        }

如果您不使用Login控件,而是使用其他控件,为什么不使用简单的Response.Redirect?

private void button1_Click(object sender, EventArgs e)
{
    Response.Redirect("https://app.ebridge-solutions.com/ebridge/3.0/Default.aspx?user=Ebridge&password=test&filecabinet=E Group"); 
}

最新更新