用POST重定向? [英] Redirect with POST ?

查看:69
本文介绍了用POST重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我想用POST方法调用另一个页面,如下所示:


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


我在我的页面设置了这个

< form id =" form1"方法= QUOT;交" runat =" server


但是它不起作用...... :(


ASP.NET无法调用任何页面n POST方法?

任何人都可以帮助我,提前谢谢。


问候,

Savanah

解决方案

否。服务器与发布无关。客户端是

打包标头并发送帖子的客户端。重定向不再是

,如果用户自己键入了该URL。


您可以通过使用表单字段向下发送页面内容来玩弄技巧

填写,然后使用JavaScript立即提交。


顺便说一下,当你调用Redirect时,实际上没有页面内容是

发送到浏览器。重定向的控制机制是单个

头字段,因此ASP.NET知道发送任何

没有意义其他内容。


" Savanah" < SA ***** @ hotmail.com>在消息中写道

news:43 ********************* @ news.free.fr ...

您好,

我想用POST方法调用另一个页面,如下所示:

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

我在我的页面中设置了
< form id =" form1"方法= QUOT;交" runat =" server

但是它不起作用...... :(

ASP.NET无法调用任何页面的POST方法吗?任何人都可以帮助我,提前谢谢。

问候,
Savanah



感谢您的回复。


我尝试使用Server.Transfer,但也不能工作:(


如何使用POST方法发送URL?


" Peter Rilling"< pe *** @ nospam.rilling.net>aécritdansle message de news:
UY ************** @ TK2MSFTNGP15.phx.gbl ... < blockquote class =post_quotes>不。服务器与发布无关。客户端是打包标题并发送帖子的客户端。使用重定向不是更多的,如果用户有键入该URL本身。

您可以通过发送页面内容向下填写表单字段
填写,然后使用JavaScript做一个立即提交。

顺便说一句,当您调用Redirect时,实际上没有任何页面内容被发送到浏览器。重定向的控制机制是一个单独的头部字段,因此ASP.NET知道发送任何其他内容没有意义。

Savanah < SA ***** @ hotmail.com>在消息中写道
新闻:43 ********************* @ news.free.fr ...

你好,

我想用POST方法调用另一个页面,比如这样:



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

我在我的页面中设置了
< form id =" form1"方法= QUOT;交" runat =" server

但是它不起作用...... :(

ASP.NET无法调用任何页面的POST方法吗?任何人都可以帮助我,提前谢谢。

问候,
Savanah




< blockquote>因此写了Peter,

不。服务器与发布无关。客户端是打包标题并发送帖子的客户端。使用Redirect是
如果用户自己输入了这个URL,那就更多了。




这可能是受欢迎的信念,但不是真的。


HTTP定义状态代码307(临时重定向)以将POST重定向为POST。

每个人都知道OTOH的普通重定向是302

(找到),这就是你打电话给HttpResponse.Redirect()所得到的。为了让

a悲伤的故事简短,302盲目地将POST变成GET(首先它是bug,今天

这是一个特色)。


但是在ASP.NET中实现307重定向并不困难:


public void RedirectTemporary(string url){

Response.ClearContent();

Response.StatusCode = 307;

Response.StatusDescription =" Temporary Redirect";

回复.RedirectLocation = ResolveClientUrl(url); //这假设url

是相对的,比如〜/ PathTo / WebForm.aspx

Response.Flush();

}


注意:根据HTTP 1.1规范,浏览器应在

重定向POST请求之前警告用户。 Firefox遵循规范,IE6不是。


干杯,

-

Joerg Jooss
< a href =mailto:ne ******** @ joergjooss.de> ne ******** @ joergjooss.de


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

解决方案

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



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




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


这篇关于用POST重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆