Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Send form data to another page

 
Thread Tools Search this Thread
Old 03-05-2005, 04:37 PM   #1
Default Send form data to another page


How can I redirect to another page with form data?
In asp Classic I write:
<form ... action="filename">...</form>
and in then target page I write
<%=request.form("fieldname")%>

.....
but in ASP.NET 1.1 'action' does not exist
how can I send form data to another page?... and how can I read a form
values (same of ASP classic with request.form("fielsname")?)

Thanks
Andrea

Sorry I know that is stupid question, but I try to translate ASP Classic App
to ASP.NET




Andrea De Santi
  Reply With Quote
Old 03-05-2005, 04:57 PM   #2
Calvin Luttrell
 
Posts: n/a
Default Re: Send form data to another page

Andrea,

You can still use the functionality in .Net to post a form to another page. However you can not use the Server controls since you will be bypassing the plumping you just use html controls like you would in classic asp.


-Calvin Luttrell
ProjectThunder.com, Inc.
nothing is impossible


> How can I redirect to another page with form data?
> In asp Classic I write:
> <form ... action="filename">...</form>
> and in then target page I write
> <%=request.form("fieldname")%>
>
> ....
> but in ASP.NET 1.1 'action' does not exist
> how can I send form data to another page?... and how can I read a form
> values (same of ASP classic with request.form("fielsname")?)
>
> Thanks
> Andrea
>
> Sorry I know that is stupid question, but I try to translate ASP Classic App
> to ASP.NET


  Reply With Quote
Old 03-05-2005, 05:06 PM   #3
Tampa.NET Koder
 
Posts: n/a
Default Re: Send form data to another page

The action attribute cannot be used if you are using a form with the
runat=server attribute. The default model for asp.net is to have the page
postback to itself and then you handle any redirect upon post back with
response.redirect() or server.transfer(). If you still would like this,
then you cann't use the asp.net webcontrols as your form controls. You must
revert back to HTML form controls.


"Andrea De Santi" <> wrote in message
news:...
> How can I redirect to another page with form data?
> In asp Classic I write:
> <form ... action="filename">...</form>
> and in then target page I write
> <%=request.form("fieldname")%>
>
> ....
> but in ASP.NET 1.1 'action' does not exist
> how can I send form data to another page?... and how can I read a form
> values (same of ASP classic with request.form("fielsname")?)
>
> Thanks
> Andrea
>
> Sorry I know that is stupid question, but I try to translate ASP Classic
> App to ASP.NET
>
>



  Reply With Quote
Old 03-05-2005, 05:14 PM   #4
jongalloway
 
Posts: n/a
Default Re: Send form data to another page

That's called Cross Page Posting (may help with searching).

They moved away from that with ASP.NET 1.0 and 1.1, but it's being
added back in for ASP.NET 2.0. Until then, it's not easy to do with
ASP.NET 1.1. I'd recommend converting to a single page with panels - it
seems to fit more smoothly with the way the ASP.NET framework is
designed to work.

This page has some good information on that approach:
http://www.dotnetjohn.com/articles.aspx?articleid=160

Another option is to post back to the first page, save the form
variables, and go to the second page. You can either add the form
variables to the HttpContext and use Server.Transfer, or add them to
the Session and Redirect. Using HttpContext keeps your session
uncluttered, but you can't use it with Redirect.

If you're determined to post to another page, you can circumvent the
postback mechanism with some javascript. It's a little more complex
than you'd think, since ASP.NET sees this as an attempt to hack your
site by tampering with form Viewstate. Here's an article on that:
http://www.codeproject.com/aspnet/jsnopostback.asp

Hope that helps.

- Jon
http://weblogs.asp.net/jgalloway

  Reply With Quote
Old 03-05-2005, 05:54 PM   #5
Andrea De Santi
 
Posts: n/a
Default Re: Send form data to another page

Thanks


"jongalloway" <> ha scritto nel messaggio
news: oups.com...
> That's called Cross Page Posting (may help with searching).
>
> They moved away from that with ASP.NET 1.0 and 1.1, but it's being
> added back in for ASP.NET 2.0. Until then, it's not easy to do with
> ASP.NET 1.1. I'd recommend converting to a single page with panels - it
> seems to fit more smoothly with the way the ASP.NET framework is
> designed to work.
>
> This page has some good information on that approach:
> http://www.dotnetjohn.com/articles.aspx?articleid=160
>
> Another option is to post back to the first page, save the form
> variables, and go to the second page. You can either add the form
> variables to the HttpContext and use Server.Transfer, or add them to
> the Session and Redirect. Using HttpContext keeps your session
> uncluttered, but you can't use it with Redirect.
>
> If you're determined to post to another page, you can circumvent the
> postback mechanism with some javascript. It's a little more complex
> than you'd think, since ASP.NET sees this as an attempt to hack your
> site by tampering with form Viewstate. Here's an article on that:
> http://www.codeproject.com/aspnet/jsnopostback.asp
>
> Hope that helps.
>
> - Jon
> http://weblogs.asp.net/jgalloway
>



  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump