English 中文(简体)
采取不同行动(而不是从我的网站上)的后继形式,并增加数据
原标题:repost form to a different action (not from my site) and add additional data

我愿这样做,因为我需要张贴到一个外国网站,并且希望避免在表格内提供隐藏的投入,因为用户可能会改变其内部的价值(或者有些人可能为他这样做)。

阁下:

<form action="<%=Url.Action("prepare") %>" >
<input type="submit" value="submit" />
</form>

我的行动

[HttpPost]
public ActionResult Prepare()
{
   if(Request.IsAuthenticated)
   {
      //post to "http://example.com/do" 
      //and add to the request userId = User.Identity.Name
      return //the result of the repost
   }
   else 
   {
      return RedirectToAction("youneedtobeloggedin",);
   }
}
最佳回答

如果你想把所有服务器放在一边,你可以查看here。 它是一种简单的方式,能够以方案方式执行《行动计划》。 这样,你就能够处理所有服务器方面的外部专业干事。 请注意,这将使你的服务器能够履行《名册》。

在你的控制下,你可以采取这一行动:

[HttpGet]
public string MyActionPostingToRemote() 
{
  string postResult = HttpPost (remoteUrl, remotePostQueryString);
  return postResult;
}

HttpPost是你在我的联系中能够发挥的职能。

问题回答

现代浏览器不允许交叉点电话。 由于安全原因。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签