简体   繁体   中英

How can I do Server.Transfer() to get Web2 site Page from Web1 site

I have two web site Web1 and Web2 on same server and same IIS.

Is there any way I can do Server.Transfer() to get Web2 site Page from Web1 site.

Web1 Site code:

    protected void btnGoToWeb2Page_Click(object sender, EventArgs e)
    {
       Server.Transfer("http://localhost:84/Home.aspx");
    }

This is not working. Please help.

Server. Trasfer works only for pages within the same website. If you want to transfer to another website you need to use Response. Redirect as in code below.

Response.Redirect("http://localhost/website2/somepage.aspx")

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