C# 如何将.aspx响应定向到控制器方法中
我正在向一个服务发送一个请求,该服务会提示一个表单。在我的请求中,我发送了一个如下所示的XML对象:C# 如何将.aspx响应定向到控制器方法中,c#,.net,asp.net-mvc,C#,.net,Asp.net Mvc,我正在向一个服务发送一个请求,该服务会提示一个表单。在我的请求中,我发送了一个如下所示的XML对象: <PaymentRequest> <ClientKey>CJOFSTEXFILE</ClientKey> <TransactionID>TESTTESTTEST1</TransactionID> <RedirectURL>http://localhost:44300/efile/GeneratingXMLFormRespon
<PaymentRequest>
<ClientKey>CJOFSTEXFILE</ClientKey>
<TransactionID>TESTTESTTEST1</TransactionID>
<RedirectURL>http://localhost:44300/efile/GeneratingXMLFormResponse</RedirectURL>
<Amount>-1</Amount>
<GetToken>1</GetToken>
</PaymentRequest>
有几个问题:
1) 如何将此POST请求定向到Efile控制器中的控制器方法?现在我遇到了一个错误,因为我没有一个名为Epayment.aspx的方法。我尝试创建了一个名为this的方法,但没有正常工作
2) 服务是否可以将POST请求发送到Referer URL?这是我在XML中提供的URL,但是服务使用的是另一个URL,我不能100%确定它是从哪里获得的。使用
actionname属性装饰您的EPayment
操作,如下所示:
public class efileController : System.Web.Mvc.Controller {
[ActionName("EPayment.aspx")]
public ActionResult EPayment() {
// "EPayment" method name could be *any* name you wanted.
// The method name will never be exposed via the public API
// as long as you are using the ActionName attribute.
return View();
}
}
我最亲爱的同志,这是绝对完美的答案。非常感谢。
public class efileController : System.Web.Mvc.Controller {
[ActionName("EPayment.aspx")]
public ActionResult EPayment() {
// "EPayment" method name could be *any* name you wanted.
// The method name will never be exposed via the public API
// as long as you are using the ActionName attribute.
return View();
}
}