Form method="GET"

Ok, it must be too early my brain isn't working.  When you use the get method, are all form name/value pairs auto added to the querystring?  I inherited an ASP project with tons long urls including several querystring parameters, but I only want a couple of them passed.  I can't find where they are being appended to the url.  the action is <%= thisPage %> which is the url, without any querystring (which I verified by response.write(thisPage))

If I change it so that the tag is
<form action=<%= thisPage&"?test=yes&" %>
then the page posts except that test=yes is not present, but the other params are.

It is not redirecting anywhere because if i change it so that the action is <%= "goNowhere?test=yes&" %>
then the page goes to the 404 error with the same url and querystrings as above (test=yes is not present, but the other params are.)
HTH, rchern.

Churned Ajax Toolkit

Please choose "Mark as Answer" for the posts that lead you to a solution.
0
rchern13
9/28/2005 1:31:32 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

5 Replies
608 Views

Similar Articles

[PageSpeed] 10

Instead of

<form action=<%= thisPage&"?test=yes&" %>

use

<form action="<%=thisPage%>">
<input type=hidden name=test value="yes">
0
Aidy
9/28/2005 1:55:49 PM
Set a hidden form field element on the page with the value and it will be posted with the form.

Eric
Pascarello.com | Twitter epascarello | LinkedIn
0
A1ien51
9/28/2005 2:52:11 PM
 rchern13 wrote:
When you use the get method, are all form name/value pairs auto added to the querystring?

Yes.

If you need to use the querystring to add parameters manually, change the method on the form to POST. But it's better to use Eric's suggestion add a hidden input field.

It's a smart idea to change the method to post if you have many parameters to pass.

--
Tarjei
0
tarjei
9/28/2005 3:14:28 PM
So by having a hidden field in the form, it is automatically put in the querystring?

*stops pulling out hair*
HTH, rchern.

Churned Ajax Toolkit

Please choose "Mark as Answer" for the posts that lead you to a solution.
0
rchern13
9/28/2005 3:28:08 PM
 rchern13 wrote:
So by having a hidden field in the form, it is automatically put in the querystring?


This should be fairly easy for you to test out and see, but to clarify:

  • If you use method="get", all form fields and their values will be added to the querystring. Use Request.QueryString["myFormField"] to get the form value you want.
  • If you use method="post", nothing is added to the querystring. Use Request.Form["myFormField"] to get the form value you want.
  • With method="post" you can add a querystring parameter manually. Use Request.Form["myFormField"] to get the form value you want. Use Request.QueryString["myUrlParameter"] to get the value from the querystring.
--
Tarjei
0
tarjei
9/29/2005 7:49:00 AM
Reply:

Similar Artilces:

Multiple "Forms" in a Web Form.
Hi, this query relates to ASP.NET 2.0. I use C# but answers in C# or VB.Net is fine. I have a form to capture a person's details. The form is the usual forename, surname, etc. and the Person is held in a Person Class. What I want to be able to do is to move the form creation into a Class in a separate Class in App_Code. This will enable a button to be placed on the web form to "Add Another Person" using the class. This would create a new Person object and write a new form into the page for the second person to fill in their details. Naturally, this could continue to n Pe...

<form id="form" runat="server">
hey i have a very similar problem to this thread http://forums.asp.net/thread/1440587.aspx"Control 'ctl00_ContentPlaceHolder1_Login1' of type 'Login' must be placed inside a form tag with runat=server. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Control 'ctl00_ContentPlaceHolder1_Login1' of type 'Login' must be placed inside a form tag with r...

<authentication mode="Forms">forms name=".AUTHCOOKIE"
Hi there, I used authentication mode="Forms" with AUTHCOOKIE. my web.config looks like this <system.web> <authentication mode="Forms"><forms name=".AUTHCOOKIE" loginUrl="default.aspx" protection="All" /> </authentication><machineKey  validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" /><authorization> <deny users="?" /> </authorization>   </system.web>    So far so good, but ... I have a f...

Is "Session" the best solution for transfering variables between "Web Forms"??
Hi all; I am using an ASP.NET Web Application (with VB.NET)... and this App used to manage customers' requests.. so, ther user will handel customer#1 data for a while, then he (the user) will handle the data of customer#2. and so on.. And I need to transfer some variables value from one page (Web Form) to onother pages (Web Forms), Is the "Session" variable the BEST solution? and do you recommend me to increase its live to 60 mins or more. (In case the user need approx. 1 hour to handle customer#1 data!!)?? Example of values I want to transfer: CustomerID, RequestNo, Co...

superreview requested: [Bug 410500] Add "Web form password" description to web form keychain items : [Attachment 295140] fix
Stuart Morgan <stuart.morgan@alumni.case.edu> has asked Mark Mentovai <mark@moxienet.com> for superreview: Bug 410500: Add "Web form password" description to web form keychain items https://bugzilla.mozilla.org/show_bug.cgi?id=410500 Attachment 295140: fix https://bugzilla.mozilla.org/attachment.cgi?id=295140&action=edit ...

superreview denied: [Bug 410500] Add "Web form password" description to web form keychain items : [Attachment 295140] fix
Mark Mentovai <mark@moxienet.com> has denied Stuart Morgan <stuart.morgan@alumni.case.edu>'s request for superreview: Bug 410500: Add "Web form password" description to web form keychain items https://bugzilla.mozilla.org/show_bug.cgi?id=410500 Attachment 295140: fix https://bugzilla.mozilla.org/attachment.cgi?id=295140&action=edit ------- Additional Comments from Mark Mentovai <mark@moxienet.com> Not localizable :( ...

problem submitting form in html mail for forms with method="post"
Name: Tommy Daniels Product: Thunderbird Summary: problem submitting form in html mail for forms with method="post" Comments: I know this is already a reported bug but I'd love to see this fixed or even a work around. ...

"multipart/form-data" Method "POST" to cgi script not working
Hello all, If anyone could shed some light on this I would be in there debt. I know what the BIG problem is...these scripts where written in perl5.004 and we have moved or are moving to 5.6.0, but I don't know where to start looking to fix the code so that is works with 5.6.0. This is a "multipart/form-data" form, using method "POST" I'm unable to retrieve the params passed to the cgi via "$cgi->param('PARAM')", HOWEVER, if the method is "GET" the "$cgi->param('PARAM')" works, but "GET" is no...

Error on <form enctype="multipart/form-data" runat="server">
Hi to all... i have this problem which occured when i was uploading a picture into the SQL 2000. i am using VB script and Microsoft Visual Studio 2005... the error on"<pages enableEventValidation="true"/>"... can anyone help me??  i am using a master template for my webpage... everything work jus fine before i insert this "<form enctype="multipart/form-data" runat="server">" at the top of the page after "<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server&...

"multipart/form-data" Method "POST" to cgi script not working
Hello all, If anyone could shed some light on this I would be in there debt. I know what the BIG problem is...these scripts where written in perl5.004 and we have moved or are moving to 5.6.0, but I don't know where to start looking to fix the code so that is works with 5.6.0. This is a "multipart/form-data" form, using method "POST" I'm unable to retrieve the params passed to the cgi via "$cgi->param('PARAM')", HOWEVER, if the method is "GET" the "$cgi->param('PARAM')" works, but "GET" is no...

What if I remove <form id="form1" runat="server"></form>
If I am creating an aspx page, which does not need to be a form, i.e. no input is taken from the user, do I need to encapsulate the whole page with in  <form1 runat="server">   What are the implications of removing the form? I realize there will be no viewstate, and again, I won't be able to accept user input, but will everything else work as expected? It seems to be so far, I've just not seen ANY examples where the form tag has been removed. Thanks, Darragh You need the server-side form tag if you are going to have server-side controls on the form.RyanRyan Olshan...

Need to have a form "in front of" login form that would open the login form.
Hello: I need to show a web app I have built to a client who does not have a web site.  Their app will be on a site I use for testing.  I want to put a"testapp" button on a form that then starts their app.    The client's app has a login control, however, so when I call up that app's default page, the login page appears as it should. Can I put another web page "in front of"  the login page that would have a button to call the default page which then would cause the login page to come up?  If not possible, can I have 2 asp.net 2.0 apps runn...

"multipart/form-data" Method "POST" to cgi script not working #2
Hello all, If anyone could shed some light on this I would be in there debt. I know what the BIG problem is...these scripts where written in perl5.004 and we have moved or are moving to 5.6.0, but I don't know where to start looking to fix the code so that is works with 5.6.0. This is a "multipart/form-data" form, using method "POST" I'm unable to retrieve the params passed to the cgi via "$cgi->param('PARAM')", HOWEVER, if the method is "GET" the "$cgi->param('PARAM')" works, but "GET" is no...

"multipart/form-data" Method "POST" to cgi script not working #2
Hello all, If anyone could shed some light on this I would be in there debt. I know what the BIG problem is...these scripts where written in perl5.004 and we have moved or are moving to 5.6.0, but I don't know where to start looking to fix the code so that is works with 5.6.0. This is a "multipart/form-data" form, using method "POST" I'm unable to retrieve the params passed to the cgi via "$cgi->param('PARAM')", HOWEVER, if the method is "GET" the "$cgi->param('PARAM')" works, but "GET" is no...

Web resources about - Form method="GET" - asp.net.web-forms

Resources last updated: 1/11/2016 10:47:19 AM