One of the hinderances we had in earlier verions of ASP.NET (1.1 & 1.0 versions) were that, to pass data between pages, we need to use QueryString, Server.Transfer, Sessions etc.,. This was a little surprising for people who come from ASP background who are
used to <form method="post" action="newpage.asp">
One of the hinderances we had in earlier verions of ASP.NET (1.1 & 1.0 versions) were that, to pass data between pages, we need to use QueryString, Server.Transfer, Sessions etc.,. This was a little surprising for people who come from ASP background who are
used to <form method="post" action="newpage.asp">
In your Form tag, you have defined as action="test2.aspx" and in your button definition, you have specified the
PostBackUrl="subscribe_action.aspx"
Which is the new page? I tried copying the same code and changed only the action tag and postbackurl to be of the same page and I could be able to access the Request.Form value.
ranganh
Star
12085 Points
2435 Posts
Microsoft
Whidbey: Passing data between Pages
Apr 06, 2005 10:14 AM|LINK
Hi,
One of the hinderances we had in earlier verions of ASP.NET (1.1 & 1.0 versions) were that, to pass data between pages, we need to use QueryString, Server.Transfer, Sessions etc.,. This was a little surprising for people who come from ASP background who are used to <form method="post" action="newpage.asp">
Please check http://harishmvp.blogspot.com/2005/04/whidbey-passing-data-between-pages.html on how Whidbey addressed this effectively.
Thanks.
Link Updated
Harish
http://geekswithblogs.net/ranganh
anilrajan2
Member
25 Points
5 Posts
Re: Whidbey: Passing data between Pages
Apr 20, 2005 11:22 AM|LINK
hi
i read you blog ,good info.if you are using a server.transfer() to redirect to new page in asp.net1.x however Request.Form[] can still be used .
eckhor84
Member
100 Points
20 Posts
Re: Whidbey: Passing data between Pages
Nov 17, 2005 01:04 AM|LINK
ranganh
Star
12085 Points
2435 Posts
Microsoft
Re: Whidbey: Passing data between Pages
Nov 17, 2005 09:18 AM|LINK
Sorry for the broken link.
The new link is http://harishmvp.blogspot.com/2005/04/whidbey-passing-data-between-pages.html
Thanks.
Harish
http://geekswithblogs.net/ranganh
mlasell
Member
467 Points
173 Posts
Re: Whidbey: Passing data between Pages
Sep 22, 2006 05:13 PM|LINK
I tried this, the page did indeed post to a new page but nothing happened on the new page. Here is the code from the new page:
<script runat="server">
void Page_Load(Object Sender, EventArgs e) {
if (Request.Form["Name"] != null){
Response.Write(Server.HtmlEncode("Hello " + Request.Form["Name"]));
}
}
</script>
There doesn't seem to be Request.Form["Name"] value, though that Text field is being sent.
Here is the posting page:
<form method="POST" id="Form1" action="test2.aspx" runat="server" >
Name: <asp:TextBox ID="Name" MaxLength="400" Width="210px" runat="server"/><br />
<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="SubmitBtn_Click" PostBackUrl="subscribe_action.aspx" />
</form>
Where am I going wrong?
Thanks, Michael
ranganh
Star
12085 Points
2435 Posts
Microsoft
Re: Whidbey: Passing data between Pages
Sep 24, 2006 05:56 AM|LINK
Hi,
In your Form tag, you have defined as action="test2.aspx" and in your button definition, you have specified the PostBackUrl="subscribe_action.aspx"
Which is the new page? I tried copying the same code and changed only the action tag and postbackurl to be of the same page and I could be able to access the Request.Form value.
Write back if this doesnt help.
Thanks.
Harish
http://geekswithblogs.net/ranganh