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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With