Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > POST and redirect

Reply
Thread Tools

POST and redirect

 
 
ETK
Guest
Posts: n/a
 
      11-15-2004
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


 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      11-15-2004
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" <> wrote in message
news:cna4a2$hfc$...
> 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
>


 
Reply With Quote
 
 
 
 
ETK
Guest
Posts: n/a
 
      11-15-2004
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]" <> wrote in message
news:...
> 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" <> wrote in message
> news:cna4a2$hfc$...
>> 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
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Response.redirect does not redirect from .aspx page =?Utf-8?B?VHJveQ==?= ASP .Net 3 10-15-2008 09:07 PM
Redirect to secure FTP site via response.redirect Ron Howard ASP General 2 08-11-2004 07:40 PM
Basic Q - Response.Redirect, all redirect to first Response.Redirect statement Sal ASP .Net Web Controls 1 05-15-2004 03:46 PM
Post post post. Shel-hed Computer Support 2 11-08-2003 07:41 AM
LWP::UserAgent to POST and redirect browser at the same time La Jesus Perl 9 10-27-2003 09:55 PM



Advertisments