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

48 Views Asked by At

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.

1

There are 1 best solutions below

2
On BEST ANSWER

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")