473,320 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

POST and redirect

ETK
Hi,
I need to POST data to some aspx page and after that redirect to this page
( page isn't on my local server where my page is). Is it possible to do this
from aspx code on server side?
Thanks,
Dalibor
Nov 18 '05 #1
2 4424
Hi Dalibor,

You could use the Webclient class for this. You need to know the names of
the Posted controls. Then do you response.redirect:
Sub DoPost()
Dim uriString As String = _
"http://localhost/p4320work/mySpecialPage.aspx"
Dim strGoName As String
strGoName = TextBox1.Text
' Create a new WebClient instance.
Dim myWebClient As New System.Net.WebClient
Dim myNameValueCollection As New _
System.Collections.Specialized.NameValueCollection
myNameValueCollection.Add("go1", strGoName)
myNameValueCollection.Add("Button1", "")
Dim responseArray As Byte() = myWebClient.UploadValues _
(uriString, "POST", myNameValueCollection)
Response.Redirect("http://msdn.microsoft.com/")
End Sub

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

"ETK" <da***********@ericsson.com> wrote in message
news:cn**********@newstree.wise.edt.ericsson.se...
Hi,
I need to POST data to some aspx page and after that redirect to this page
( page isn't on my local server where my page is). Is it possible to do
this from aspx code on server side?
Thanks,
Dalibor


Nov 18 '05 #2
ETK
Hi Ken,
I get next error: "The underlying connection was closed: Unable to connect
to the remote server.". I think that it is because I have to use PROXY
(probably I should set proxy settings somewhere in code). I'll try to solve
this.
But it seems to me that when I do Response.Redirect on the some page I do
POST, that it is a new request for page and page wouldn't get data my page
have to post. I need to post data and redirect with posted data to this page
(show result in browser).

Thanks,
Dalibor

"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:eS**************@TK2MSFTNGP15.phx.gbl...
Hi Dalibor,

You could use the Webclient class for this. You need to know the names of
the Posted controls. Then do you response.redirect:
Sub DoPost()
Dim uriString As String = _
"http://localhost/p4320work/mySpecialPage.aspx"
Dim strGoName As String
strGoName = TextBox1.Text
' Create a new WebClient instance.
Dim myWebClient As New System.Net.WebClient
Dim myNameValueCollection As New _
System.Collections.Specialized.NameValueCollection
myNameValueCollection.Add("go1", strGoName)
myNameValueCollection.Add("Button1", "")
Dim responseArray As Byte() = myWebClient.UploadValues _
(uriString, "POST", myNameValueCollection)
Response.Redirect("http://msdn.microsoft.com/")
End Sub

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

"ETK" <da***********@ericsson.com> wrote in message
news:cn**********@newstree.wise.edt.ericsson.se...
Hi,
I need to POST data to some aspx page and after that redirect to this
page ( page isn't on my local server where my page is). Is it possible to
do this from aspx code on server side?
Thanks,
Dalibor

Nov 18 '05 #3

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

Similar topics

3
by: David E. Smith | last post by:
I want to redirect input from one page to another, but it's POST content. If it were GET, I could just do something like: header("Location: /new/form.php?a=1&b=2") I can't rewrite the...
10
by: Dave Smithz | last post by:
Hi there, I have a situation where I want to have multiple submit buttons on the same form and therefore want to use a redirection php script that checks the value associated with the submit...
11
by: Alex Hunsley | last post by:
A question that has certainly been asked before and I've googled etc. for answers with no certain outcome... I'd like my PHP script to redirect the client browser to another page, POSTing some...
2
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...
0
by: barrybevel | last post by:
Hi, I'm trying to login to the www.vodafone.ie website using HttpWebRequest. It works fine with IE/Firefox and the .NET Web Control too, just not with my code. I think it's a redirect 302...
5
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
I am trying to create ASPX code which will allow me to redirect a user to another site with POST data. I figure that the best way to do this is with JavaScript to the client. Here's what I'm doing:...
5
by: MikeB | last post by:
Hello All, I need to post / redirect to a 3rd party URL with the form variables dynamically created. Can anyone give me any pointers? TIA
0
by: KyleUbenk | last post by:
Well I have a problem that i want to send a Post Request to a Webproxy site like http://www.cloakme.us/ with the parameter __new_url and a value of another site which I want to login with a ...
56
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.