I'm trying to figure out how to post data in my C# codebehind while redirecting to another page. When the user clicks on a button in page1.aspx, he should be taken to page2.aspx. The C# codebehind of page2.aspx should be able to access a variable (a primary key) which is determined based on which button in page1.aspx was clicked. So page1.aspx needs to post the primary key that corresponds to that button, and page2.aspx needs to retrieve that primary key.

I'm not sure how to do this while redirecting from page1.aspx to page2.aspx using Response.Redirect(). I heard Server.Transfer() might be able to do it, but I'm at a loss there to in understanding how to use it.

The buttons in page1.aspx are in a table, which is in an ASP.NET content (i.e. <asp:content...>), which is declared/defined (I'm not sure what the right term is here) in a master page. All the contents in the master page are contained in a form. I mention this only because I've tried setting the method attribute in this form to "POST" without any luck, and also because you probably need to know the structure of my page.

So is there a way to redirect to another page from the C# codebehind while at the same time posting data to be retrieved by that other page?