Send parameter to another ASP.Net page

asp.net, c#, parameters

Solution

Aside from the fact that you cannot just put "p1" in a string and have it reference a class instance, you cannot just add an object as a query argument.

You will need to add arguments to the URL for each element of `Point`. For example:

Response.Redirect(String.Format("~/page2.aspx?x={0}&y={1}", p1.x, p1.y));

Alternatively, you could use `Session` if you don't need it as a query argument.

Problem

I have class in c# called "Point". ``` public class Point(){ . . } ``` In page1.aspx I created: ``` Point p1 = new Point(); ``` I want to send it to page2.aspx. I try to send with: ``` Response.Redirect("~/page2.aspx?x=p1"); ``` And get it in page 2 with: ``` Point p2 =Request.QueryString["x"]; ``` It does not work. Can you help me please?

Original source