473,387 Members | 1,669 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,387 software developers and data experts.

Redirect with POST ?

Hello,

I would like to call another page using POST method, something like this :

Response.Redirect("http://www.mydomain.com/cgi-bin/log.dll?email="+tbLoginID").

I set this in my page
<form id="form1" method="post" runat="server

But it's doen't work... :(

ASP.NET cannot call any page n POST method ?
Anyone can help me, thank in advance.

Regards,
Savanah
Feb 7 '06 #1
10 7111
No. The server has nothing to do with posting. The client is the one that
packages the headers and sends the post. Using Redirect is nothing more
that if the user had typed that URL in themselves.

You can play tricks by sending the page contents down with the form fields
filled in, then using JavaScript do a submit immediately.

By the way, when you call Redirect, none of the page contents actually is
sent to the browser. The control mechanism for redirecting is a single
header field and so ASP.NET knows that there is no point in sending down any
other content.

"Savanah" <sa*****@hotmail.com> wrote in message
news:43*********************@news.free.fr...
Hello,

I would like to call another page using POST method, something like this :

Response.Redirect("http://www.mydomain.com/cgi-bin/log.dll?email="+tbLoginID").

I set this in my page
<form id="form1" method="post" runat="server

But it's doen't work... :(

ASP.NET cannot call any page n POST method ?
Anyone can help me, thank in advance.

Regards,
Savanah

Feb 7 '06 #2
Thank you for your reply.

I try to use Server.Transfer but don't work too :(

How I can send URL using POST method ?

"Peter Rilling" <pe***@nospam.rilling.net> a écrit dans le message de news:
uY**************@TK2MSFTNGP15.phx.gbl...
No. The server has nothing to do with posting. The client is the one
that packages the headers and sends the post. Using Redirect is nothing
more that if the user had typed that URL in themselves.

You can play tricks by sending the page contents down with the form fields
filled in, then using JavaScript do a submit immediately.

By the way, when you call Redirect, none of the page contents actually is
sent to the browser. The control mechanism for redirecting is a single
header field and so ASP.NET knows that there is no point in sending down
any other content.

"Savanah" <sa*****@hotmail.com> wrote in message
news:43*********************@news.free.fr...
Hello,

I would like to call another page using POST method, something like this
:

Response.Redirect("http://www.mydomain.com/cgi-bin/log.dll?email="+tbLoginID").

I set this in my page
<form id="form1" method="post" runat="server

But it's doen't work... :(

ASP.NET cannot call any page n POST method ?
Anyone can help me, thank in advance.

Regards,
Savanah


Feb 7 '06 #3
Thus wrote Peter,
No. The server has nothing to do with posting. The client is the one
that packages the headers and sends the post. Using Redirect is
nothing more that if the user had typed that URL in themselves.


That's probably popular belief, but not true.

HTTP defines status code 307 (Temporary Redirect) to redirect a POST as POST.
The run-of-the-mill redirect everybody knows OTOH is 302
(Found), which is what you get if you call HttpResponse.Redirect(). To make
a sad story short, a 302 blindly turns POST into GET (first it was bug, today
it's a feature).

But it's not hard to implement a 307 redirect in ASP.NET:

public void RedirectTemporary(string url) {
Response.ClearContent();
Response.StatusCode = 307;
Response.StatusDescription = "Temporary Redirect";
Response.RedirectLocation = ResolveClientUrl(url); // this assumes url
is relative, like "~/PathTo/WebForm.aspx"
Response.Flush();
}

Note: According to the HTTP 1.1 spec, a browser should warn the user before
redirecting a POST request. Firefox follows the spec, IE6 doesn't.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 7 '06 #4
I learned something, cool.

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:94**************************@msnews.microsoft .com...
Thus wrote Peter,
No. The server has nothing to do with posting. The client is the one
that packages the headers and sends the post. Using Redirect is
nothing more that if the user had typed that URL in themselves.


That's probably popular belief, but not true.
HTTP defines status code 307 (Temporary Redirect) to redirect a POST as
POST. The run-of-the-mill redirect everybody knows OTOH is 302 (Found),
which is what you get if you call HttpResponse.Redirect(). To make a sad
story short, a 302 blindly turns POST into GET (first it was bug, today
it's a feature).

But it's not hard to implement a 307 redirect in ASP.NET:

public void RedirectTemporary(string url) {
Response.ClearContent();
Response.StatusCode = 307;
Response.StatusDescription = "Temporary Redirect";
Response.RedirectLocation = ResolveClientUrl(url); // this assumes url is
relative, like "~/PathTo/WebForm.aspx"
Response.Flush();
}

Note: According to the HTTP 1.1 spec, a browser should warn the user
before redirecting a POST request. Firefox follows the spec, IE6 doesn't.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de

Feb 7 '06 #5
Thus wrote Peter,
I learned something, cool.


You're welcome :-)

I just wish the ASP.NET product team would include this as another HttpResponse.Redirect()
overload:

HttpResponse.Redirect(string url, bool endResponse, HttpRedirectStatus status)

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 7 '06 #6
Thus wrote Joerg,
But it's not hard to implement a 307 redirect in ASP.NET:

public void RedirectTemporary(string url) {
Response.ClearContent();
Response.StatusCode = 307;
Response.StatusDescription = "Temporary Redirect";
Response.RedirectLocation = ResolveClientUrl(url); // this assumes
url
is relative, like "~/PathTo/WebForm.aspx"
Response.Flush();
}


Important note: The receiving web form must apply the directive EnableViewStateMac="false",
otherwise Machine Authentication Check blows up in your face.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 8 '06 #7
Thank you Joerg Joos.

But you method don't work with .NET v1.1, I got error on ResolveClientUrl
function

I'm trying to use Server.Transfer like this :

Server.Transfer("http://localhost/cgi-bin/webengine.dll/log?email="+tbMail.Text+"&pw="+tbPassword.Text");
// Server redirection

I got error message :
"Error executing child request for
"http://localhost/cgi-bin/webengine.dll/log?email="+tbMail.Text+"&pw="+tbPassword.Text"

Why ? I can access at this page when copy and paste URL into IE ...

Regards,
Savanah
"Joerg Jooss" <ne********@joergjooss.de> a écrit dans le message de news:
94**************************@msnews.microsoft.com...
Thus wrote Joerg,
But it's not hard to implement a 307 redirect in ASP.NET:

public void RedirectTemporary(string url) {
Response.ClearContent();
Response.StatusCode = 307;
Response.StatusDescription = "Temporary Redirect";
Response.RedirectLocation = ResolveClientUrl(url); // this assumes
url
is relative, like "~/PathTo/WebForm.aspx"
Response.Flush();
}


Important note: The receiving web form must apply the directive
EnableViewStateMac="false", otherwise Machine Authentication Check blows
up in your face.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de

Feb 8 '06 #8
Thus wrote Savanah,
Thank you Joerg Joos.

But you method don't work with .NET v1.1, I got error on
ResolveClientUrl function
Yes, this a .NET 2.0 API.
I'm trying to use Server.Transfer like this :

Server.Transfer("http://localhost/cgi-bin/webengine.dll/log?email="+tb
Mail.Text+"&pw="+tbPassword.Text");

// Server redirection

I got error message :
"Error executing child request for
"http://localhost/cgi-bin/webengine.dll/log?email="+tbMail.Text+"&pw="
+tbPassword.Text"
Why ? I can access at this page when copy and paste URL into IE ...


That cannot work. HttpServerUtility.Transfer() only works within an ASP.NET
application, and has *nothing* to do with HTTP redirects. If you cannot use
ResolveClientUrl(), just remove the call and use absolute URLs with the method
I presented.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 9 '06 #9
so ASP.NET is unable to make simple page redirection using Post method ?!!

"Joerg Jooss" <ne********@joergjooss.de> a écrit dans le message de news:
94**************************@msnews.microsoft.com...
Thus wrote Savanah,
Thank you Joerg Joos.

But you method don't work with .NET v1.1, I got error on
ResolveClientUrl function


Yes, this a .NET 2.0 API.
I'm trying to use Server.Transfer like this :

Server.Transfer("http://localhost/cgi-bin/webengine.dll/log?email="+tb
Mail.Text+"&pw="+tbPassword.Text");

// Server redirection

I got error message :
"Error executing child request for
"http://localhost/cgi-bin/webengine.dll/log?email="+tbMail.Text+"&pw="
+tbPassword.Text"
Why ? I can access at this page when copy and paste URL into IE ...


That cannot work. HttpServerUtility.Transfer() only works within an
ASP.NET application, and has *nothing* to do with HTTP redirects. If you
cannot use ResolveClientUrl(), just remove the call and use absolute URLs
with the method I presented.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de

Feb 10 '06 #10
Thus wrote Savanah,
so ASP.NET is unable to make simple page redirection using Post method
?!!


*Please* read what I've written.

If you want to use the code I've presented with .NET 1.1, you need to drop
the line with ResolveClientUrl() and simply work with absolute URLs, e.g.
"http://host/PathTo/WebForm.aspx" instead of "~/PathTo/WebForm.aspx". Or
is there another problem I'm missing?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 10 '06 #11

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

Similar topics

10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
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...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
1
by: David | last post by:
I need to redirect to a page and HTTP Post data. The Response.Redirect does not work and the HTTPREQUEST option calls the page and waits for a response, but I need to transfer control to the...
7
by: Carl | last post by:
these are three files below : submit.html <html> <head> </head> <body> <form action="redirect.php" method="POST" > <input type="text" name="value" value="test" > <input type="submit" >...
1
by: hbhashemi | last post by:
Hi, I want to redirect POST request by mod_rewrite but I couldn't. According to this link: http://www.thescripts.com/forum/thread501840.html I understood that we can't redirect POST values. Is it...
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...
8
by: RobG | last post by:
Hi there, I have a form and when the user clicks the submit button, I want the handler for that on the server side to redirect ("post") the form to a URL at another site (not my own). It should...
1
by: gnawz | last post by:
Hi guys, I have a couple of php files that perform various tasks. I will use fields in my system and provide code as well I need help as follows: My database contains the fields Category...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.