473,804 Members | 3,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

POST method ?

WJ
I have an Asp.Net page that redirects the user to another page with a piece
of data to be passed. Below is the c# instruction:

Response.Redire ct("mySpecialPa ge.aspx?go1="+s trGoName);

This will expose the "go1" parameter on the Address field of the MS/IE
browser because it uses the "GET" method. Is there a way that I can force
the system to use the "POST" method with the above payload ?

Thanks for your help,

John
Nov 18 '05 #1
9 2127
POST a form to the URL. Response.Redire ct() sends a header to the browser
instructing it to request that URL. That Request will always be GET. You
can't send a header to the browser instructing it to send a POST request.

You can add a non-WebForm (client-side) HTML form to the page anywhere
outside of the WebForm form. You can then use JavaScript to Post to its
ACTION property. A WebForm always has an ACTION property that is the same
URL as the page it's on. That's how ASP.Net does server-side event handling.
But you can certainly add another form to the page, set its ACTION property
to the URL you want to Post to, and submit it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"WJ" <Jo*******@HotM ail.Com> wrote in message
news:u6******** ******@TK2MSFTN GP12.phx.gbl...
I have an Asp.Net page that redirects the user to another page with a piece of data to be passed. Below is the c# instruction:

Response.Redire ct("mySpecialPa ge.aspx?go1="+s trGoName);

This will expose the "go1" parameter on the Address field of the MS/IE
browser because it uses the "GET" method. Is there a way that I can force
the system to use the "POST" method with the above payload ?

Thanks for your help,

John

Nov 18 '05 #2
WJ

"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:uq******** ******@TK2MSFTN GP12.phx.gbl...
POST a form to the URL. Response.Redire ct() sends a header to the browser


Thanks for your response. I understand all this and I know that GET method
also uses form too. I just wonder why not make one for POST also. It is very
convenient.

John
Nov 18 '05 #3
> Thanks for your response. I understand all this and I know that GET method
also uses form too.
A Form can POST or GET, but Response.Redire ct() is always GET. As for why,
you would have to ask the W3C.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"WJ" <Jo*******@HotM ail.Com> wrote in message
news:e$******** ******@TK2MSFTN GP09.phx.gbl...
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:uq******** ******@TK2MSFTN GP12.phx.gbl...
POST a form to the URL. Response.Redire ct() sends a header to the
browser
Thanks for your response. I understand all this and I know that GET method
also uses form too. I just wonder why not make one for POST also. It is very convenient.

John

Nov 18 '05 #4
Hi John,

You can simulate a post using the WebClient class. Here's the idea:

Sub DoPost()
Dim uriString As String = _
"http://localhost/p4320work/mySpecialPage.a spx"
Dim strGoName As String
strGoName = TextBox1.Text
' Create a new WebClient instance.
Dim myWebClient As New System.Net.WebC lient
Dim myNameValueColl ection As New _
System.Collecti ons.Specialized .NameValueColle ction
myNameValueColl ection.Add("go1 ", strGoName)
myNameValueColl ection.Add("But ton1", "")
Dim responseArray As Byte() = myWebClient.Upl oadValues _
(uriString, "POST", myNameValueColl ection)

Label1.Text = "Response received was :" & _
System.Text.Enc oding.ASCII.Get String(response Array)
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Call DoPost()
End Sub

Ken
Microsoft MVP [ASP.NET]

"WJ" <Jo*******@HotM ail.Com> wrote in message
news:u6******** ******@TK2MSFTN GP12.phx.gbl...
I have an Asp.Net page that redirects the user to another page with a piece
of data to be passed. Below is the c# instruction:

Response.Redire ct("mySpecialPa ge.aspx?go1="+s trGoName);

This will expose the "go1" parameter on the Address field of the MS/IE
browser because it uses the "GET" method. Is there a way that I can force
the system to use the "POST" method with the above payload ?

Thanks for your help,

John


Nov 18 '05 #5
WJ
Thanks Ken. That does it. However, it would be nice if the whole thing can
be condensed in one statement.

John
Nov 18 '05 #6
Glad to help.

I suppose I could spend some time on it. It might be a long statement!
<grin>

"WJ" <Jo*******@HotM ail.Com> wrote in message
news:ep******** ******@TK2MSFTN GP09.phx.gbl...
Thanks Ken. That does it. However, it would be nice if the whole thing can
be condensed in one statement.

John


Nov 18 '05 #7
WJ
"Ken Cox [Microsoft MVP]" <BA************ @sympatico.ca> wrote in message
news:ei******** ******@tk2msftn gp13.phx.gbl...
I suppose I could spend some time on it. It might be a long statement!
<grin>


You done enough already. Let Bill Gate does it. All I need is a
Response.Redire ct("mySpecialPa ge.aspx?go1="+s trGoName,"POST" );

:)

John

Nov 18 '05 #8
You might want to submit it as a product suggestion. There's a big push on
to get developer feedback:

http://lab.msdn.microsoft.com/productfeedback/

You done enough already. Let Bill Gate does it. All I need is a
Response.Redire ct("mySpecialPa ge.aspx?go1="+s trGoName,"POST" );


Nov 18 '05 #9
Dear Ken,
if i have an asp page with 2 input controls (username & password),i want
from my asp.net page to post these data and submit the form and see the
returned URL,if the user has been authenticated or not.

all sample i have seen is to pass the data on POST ,considering the page is
working by passing values as Quesry string.... if not ? this method is work
using HTTPWeb Request...... or there's another method to do the above
scenario.

i want a sample code to this.
what i did,simpy i went to the login page of that system,and take the
Control IDs for the username and password.....bu t pass it as content on POST
doesnt work.....

please clarify my ideas if there's sometinhg wrong.

"Ken Cox [Microsoft MVP]" wrote:
Hi John,

You can simulate a post using the WebClient class. Here's the idea:

Sub DoPost()
Dim uriString As String = _
"http://localhost/p4320work/mySpecialPage.a spx"
Dim strGoName As String
strGoName = TextBox1.Text
' Create a new WebClient instance.
Dim myWebClient As New System.Net.WebC lient
Dim myNameValueColl ection As New _
System.Collecti ons.Specialized .NameValueColle ction
myNameValueColl ection.Add("go1 ", strGoName)
myNameValueColl ection.Add("But ton1", "")
Dim responseArray As Byte() = myWebClient.Upl oadValues _
(uriString, "POST", myNameValueColl ection)

Label1.Text = "Response received was :" & _
System.Text.Enc oding.ASCII.Get String(response Array)
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Call DoPost()
End Sub

Ken
Microsoft MVP [ASP.NET]

"WJ" <Jo*******@HotM ail.Comwrote in message
news:u6******** ******@TK2MSFTN GP12.phx.gbl...
I have an Asp.Net page that redirects the user to another page with a piece
of data to be passed. Below is the c# instruction:

Response.Redire ct("mySpecialPa ge.aspx?go1="+s trGoName);

This will expose the "go1" parameter on the Address field of the MS/IE
browser because it uses the "GET" method. Is there a way that I can force
the system to use the "POST" method with the above payload ?

Thanks for your help,

John

Oct 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2467
by: Spud | last post by:
<?php // pullpage function by Nick bouton http://www.nickbouton.com/. $CustomerID = "IDHERE"; $method = "POST"; $host = "xml.mydata.com"; $usepath = "/xml.asp"; //print all vars in an array
7
20936
by: Rui Pestana | last post by:
Hello all, I want to use the POST method to submit the form and then grab the parameters in the asp file with request.form("parm"). The problem is that I am using the _search target to open the asp page. When I use _blank target there is no problem, either I use GET or POST method. But when I use _search target, only GET method works.
15
3133
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST. When I find is that if I send the value by the GET method, response.write("From QueryString: " & Request.QueryString("usernamefromform") & "<br><br>")
2
1925
by: Asp Help | last post by:
I'm working on a ASP applicatition to create Windows 2000 users. Because I don't want everybody to have access to the site I've changed te security in IIS 5.0 which runs on a windows 2000 Sp4 server: The security on the site is mainly anonymous. The anonymous account has been changed to an account which has the right permissions. The security on one asp page (GetUser.asp) is changed to only "Windows Integrated". A User that access the...
2
3279
by: Keith Selbee | last post by:
I am trying to submit data to a webpage in the form of a post and my code is below. It is a function that takes a url and the post content as strings and then performs the post. But as soon as I add the post data to the headers I get an exception that just says "headers". Can anyone please help me here? Thanks.... public string Get(string u, string c) { WebRequest wr = WebRequest.Create(u); wr.Headers.Add(c);
5
17392
by: Tammy | last post by:
Hi, I have an aspx app which needs to post data to a form and read the response. I am confused on whether I should be using the get_url using "POST" method or the post_url using "GET" method. string get_url = "http://scmvs4:9090/gtccinfo/H485W020.HTML"; --url contains a form string post_url = "http://scmvs4:9090/cgi-bin/gticglnk/P485VEGA"; --called by get_Url upon submit
7
4265
by: | last post by:
Hello, I would like to do the following from a asp.net button click: <form method="POST" action="https://www.1234.com/trans_center/gateway/direct.cgi"> <input type="hidden" name="Merchant" value="Merchant Name"> <input type="hidden" name="OrderID" value="Unique OrderID value"> <input type="hidden" name="email" value="Customers email address (OPTIONAL)">
24
2886
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button image below it.
56
7249
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my website. The issue is that I need to gauge whether a user has any items in their basket to decide which page I redirect them too. I could
8
2404
by: Kurda Yon | last post by:
Hi, I have to decide which form-method I should use (GET or POST). I found the following recomendation: If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST. (http://www.cs.tut.fi/~jkorpela/ forms/methods.html). However, later I did not find any convinced arguments why it should
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10578
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.