Question: I am trying to pass an object from one page to another page using `<asp:hyperlink>` without any success. I was trying to invoke a C# method and put that object into a session but then I realized you can't invoke a method using `<asp:hyperlink>`. Then I thought about using `<asp:linkbutton>` but then I need to open the new webpage in a new window.

How can I go about doing this properly? Are there any other good alternatives?

Answer: 
> 
> Then I thought about using `<asp:linkbutton>` but then I need to
>  open the new webpage in a new window.
> 
> 
> 

You do not need to open a new window... add this to your server side `LinkButton` handler:

```
<asp:LinkButton id="btnYourLinkButton" runat="server" 
    OnClick="btnYourLinkButton_Click">Test</asp:LinkButton>

protected void btnLogout_Click(object sender, System.EventArgs e)
{
    var someObject = GetYourDataWithSomeFunction();
    Session["YourData"] = someObject;  // saves to session
    Response.Redirect("yourNewUrl.aspx");
}

```

This will store the value in the `Session` and redirect to a new page in the same window.

EDIT:

If you **need** to open in a new window then do the same thing as outlined above but instead of doing a `Response.Redirect` add the `window.open` javascript call to your page that is served up to open the new window:

```
ScriptManager.RegisterStartupScript(this, this.GetType(), "AUTOOPEN",
    "window.open('yourNewUrl.aspx', '_blank');", true);

```

Optionally you could just add an ajax call to your click method to setup the `Session` server side and then trigger the redirect based on your ajax call complete.
Add the object to the `Session` then redirect to the new page. In the new page, check the `Session` variable for the object.