开发者

ASP.NET MVC-2 Post to another website?

开发者 https://www.devze.com 2023-01-07 09:36 出处:网络
What is the best way to POST to another website (so that the users browser is redirected as well) in MVC2?I dont want the user to be able to see the form data simply by using \"view source\", so I\'m

What is the best way to POST to another website (so that the users browser is redirected as well) in MVC2? I dont want the user to be able to see the form data simply by using "view source", so I'm not keen on

<form action="http://other-site.com/action">
    <%= Html.TextBox("something-secret") %>
</form>

Is it instead possible (or advisable) to use 开发者_开发百科an controller action? eg

public ActionResult PostTheData() 
{
    return Post("http://other-site.com/action", "something-secret");
}


You can use this persons code: http://geekswithblogs.net/rakker/archive/2006/04/21/76044.aspx to post data to the other server. And after that use Redirect(url) to redirect to the page as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消