473,395 Members | 2,006 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,395 software developers and data experts.

How do I transfer user to another server after POST

Hi all

I do have a problem.

How can I transfer user to another server using POST. The problem is that
Server.Transfer (preserves form data) works just in current server.
Response.Redirect - uses GET method. However I have to open remote server
page using POST method. Normally this can be achieved using <form
ACTION="remote-page-url"> tag. However this is impossible with ASP.NET.
Also, using WebRequest class is not good solution, as I can post to and read
data from remote server, but user browser itselft is still connected to my
server.

Regards.
Nov 18 '05 #1
4 2827
TYhis is not an ASP.NET limitation (an "ASP.NET" page is anyway just an
HTML Page). At worst you could do something like a pure HTML Page that
contains the data as hidden field and that posts to the target page when
loaded...

That said I'm not sure it works (depending perhaps on user settings) as IMO
posting accross domains may sometimes be blocked ?

What thinks the owner of the page. Perhaps could a provide a GET version ?

Patrice

"Piotr Strycharz" <Pi*************@antispam-account.com> a écrit dans le
message de news:c6**********@nemesis.news.tpi.pl...
Hi all

I do have a problem.

How can I transfer user to another server using POST. The problem is that
Server.Transfer (preserves form data) works just in current server.
Response.Redirect - uses GET method. However I have to open remote server
page using POST method. Normally this can be achieved using <form
ACTION="remote-page-url"> tag. However this is impossible with ASP.NET.
Also, using WebRequest class is not good solution, as I can post to and read data from remote server, but user browser itselft is still connected to my
server.

Regards.

Nov 18 '05 #2

Użytkownik "Patrice" <no****@nowhere.com> napisał w wiadomości
news:%2****************@TK2MSFTNGP09.phx.gbl...
TYhis is not an ASP.NET limitation (an "ASP.NET" page is anyway just an
HTML Page).
Well - actually it is. I cannot provide my ACTION element in FORM
What thinks the owner of the page. Perhaps could a provide a GET version ?


Not possible. It is credit card verifier that allows parameters only as POST
data due to security reasons.

Piotr

Nov 18 '05 #3
Sorry, I meant actually this is not an *HTML* limitation. Let's proceed with
take 2 hopefully more clearly.

You could then change the action attribute client side using JavaScript.

My first suggestion expressed more clearly was to create an HTML page by
yourself (using response.write). You could keep your current ASP.NET page
and on postback response.write those fields as hidden value on a page that
is immediatly submitted (using JavaScript)...

As a side note, I don't really understand why the user should be really
directed to the verification site. Shouldn't the verification process be
transparent to the user and see he is still on your site ?

Patrice
"Piotr Strycharz" <Pi*************@antispam-account.com> a écrit dans le
message de news:c6**********@atlantis.news.tpi.pl...

Użytkownik "Patrice" <no****@nowhere.com> napisał w wiadomości
news:%2****************@TK2MSFTNGP09.phx.gbl...
TYhis is not an ASP.NET limitation (an "ASP.NET" page is anyway just an
HTML Page).
Well - actually it is. I cannot provide my ACTION element in FORM
What thinks the owner of the page. Perhaps could a provide a GET version

?
Not possible. It is credit card verifier that allows parameters only as POST data due to security reasons.

Piotr

Nov 18 '05 #4
You can create the post yourself
Here's some code I use to post a credit card transaction, which returns to
the caller. You can then redirect to an acknowledgement page:

Private Function viaKlixPostTransaction(ByVal trans As
viaKlixTransaction) As String
modErr.EnterFunction("OrderForm.aspx.vb.viaKlixPos tTransaction")
Dim sbldr As New StringBuilder
Dim params As NameValueCollection = trans.GetValues
Dim iEnum As IEnumerator = params.Keys.GetEnumerator

' Build the request string from the parameters
Do While iEnum.MoveNext
Dim sKey As String = iEnum.Current
If Not params.Item(sKey) Is Nothing AndAlso
params.Item(sKey).ToString <> "" Then
sbldr.Append(sKey)
sbldr.Append("=")
sbldr.Append(Server.UrlEncode(params.Item(sKey)))
sbldr.Append("&")
End If
Loop
sbldr.Remove(sbldr.Length - 1, 1) 'Remove trailing "&"

'Post the request
Dim dataResponse As String
Dim dataBody As String = sbldr.ToString
Dim webResponse As HttpWebResponse
Dim webRequestStream As System.IO.Stream
Dim webRequest As HttpWebRequest
Dim responseStream As Stream

' Create the RequestStream
Try
webRequest =
webRequest.Create("https://www2.viaklix.com/process.asp")

' Note - "KeepAlive = False" seems to be needed to avoid errors,
apparently caused by the client
' (this application) thinking the connection is being
maintained while the server or
' firewall may disconnect it. Apparently, if the client
doesn't maintain it, it will know
' enough to re-establish it when it needs it.
webRequest.KeepAlive = False

webRequest.Method = "POST"
webRequest.ContentType = "application/x-www-form-urlencoded"

' Create request body
webRequest.ContentLength = dataBody.Length
webRequestStream = webRequest.GetRequestStream()
Catch ex As Exception
modErr.WriteLog("Creating RequestStream: " & ex.ToString, 0)
End Try

' Write the WebRequest
Try
Dim writer As New StreamWriter(webRequestStream)
writer.Write(dataBody)
'TODO - writer.close can probably go into a Finally block...
Try 'Getting an exception on this shouldn't stop us...
writer.Close() 'Closes the StreamWriter and the underlying
stream
Catch ex As Exception
modErr.WriteLog("Writer.Close: " & ex.ToString, 0)
End Try

Catch ex As Exception ' Catches error on writer.write
modErr.WriteLog(ex.ToString, 0)
modErr.WriteLog(dataBody, 1) 'Looking for data dependency
modErr.ExitFunction()
Return Nothing

End Try

' Get the response from viaKlix
Try
webResponse = webRequest.GetResponse()
responseStream = webResponse.GetResponseStream()

Dim readStream As New System.IO.StreamReader(responseStream)
dataResponse = readStream.ReadToEnd

readStream.Close() 'Closes the StreamReader and the underlying
stream

modErr.ExitFunction()
Return dataResponse

Catch ex As Exception
modErr.WriteLog("Reading Response: " & ex.ToString, 0)
modErr.ExitFunction()
Return Nothing
End Try

End Function

"Piotr Strycharz" <Pi*************@antispam-account.com> wrote in message
news:c6**********@atlantis.news.tpi.pl...

Użytkownik "Patrice" <no****@nowhere.com> napisał w wiadomości
news:%2****************@TK2MSFTNGP09.phx.gbl...
TYhis is not an ASP.NET limitation (an "ASP.NET" page is anyway just an
HTML Page).
Well - actually it is. I cannot provide my ACTION element in FORM
What thinks the owner of the page. Perhaps could a provide a GET version

?
Not possible. It is credit card verifier that allows parameters only as POST data due to security reasons.

Piotr

Nov 18 '05 #5

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

Similar topics

2
by: Philip Korolev | last post by:
Hi All. I am attempting to use SSL for the first time with ASP.NET I would like to be able to send my form details to another page using https:// connection. The page I am sending data to, uses...
6
by: StephenMcC | last post by:
Hi All, Got a quick query in relation to the Server.Transfer method available in IIS 5+/ASP. I've got an issue where I want to take a portion of an online app and extract this out into a web...
5
by: Tom | last post by:
Hi I am trying to transfer to a different .ASPX page using Server.Transfer. However, I get the following error: "Error executing child request for .aspx." Anyone know why? Thanks for...
3
by: Manuel Lopez | last post by:
Hello, We have two applications that will reside on the same webserver. We want to be able to post from pages in App1 to to pages in App2. We need to pass sensible data, so we cannot use...
5
by: Julien C. | last post by:
Hi all, I have an "EditeItem.aspx" page which lets me edit properties of an "Item". In the OnClick() event of my Save button, I do save Item changes to the database and then I redirect the user...
2
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
5
by: Guadala Harry | last post by:
I've been reading up on Server.Transfer as well as doing some testing, and it appears to always raise the ThreadAbortException error. On one hand I've read a bunch of promotional-type material...
4
by: Keith Patrick | last post by:
I have an app where a Shockwave splash animation starts off my app and then sets its parent iframe's src to the value of a default page "BasicReports". BasicReports has a link to another report...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
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...
0
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...

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.