How to redirect .aspx response to controller method

I am sending a request to a service that requests a form. In my request, I am sending an XML object that looks like this:

<PaymentRequest>
<ClientKey>CJOFSTEXFILE</ClientKey>
<TransactionID>TESTTESTTEST1</TransactionID>
<RedirectURL>http://localhost:44300/efile/GeneratingXMLFormResponse</RedirectURL>
<Amount>-1</Amount>
<GetToken>1</GetToken>
</PaymentRequest>

      

XML works fine and I am getting the desired response form. However, my problem is that whenever I fill out a response and submit a post request, the redirect url is as follows:

https: // localhost: 44300 / efile / EPayment.aspx

this is the feed:

POST https://localhost:44300/efile/EPayment.aspx HTTP/1.1
Host: localhost:44300
Connection: keep-alive
Content-Length: 3349
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: https://localhost:44300
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: https://localhost:44300/efile/GeneratingXMLFormRequest
Accept-Encoding: gzip, deflate
Accept-Language: es,en-US;q=0.8,en;q=0.6

      

A few questions:

1) How can I route this POST request to a controller method in my Efile controller? Right now I am getting an error as I do not have a method called Epayment.aspx. I tried to create a method called exactly this, but it doesn't work as expected.

2) Is it possible for the service to send a POST request to the Referer url? That's the URL I provided in XML, however the service uses a different one and I'm not 100% sure where it gets it from.

+3


source to share


1 answer


Decorate your action EPayment

with the ActionNameAttribute

following:



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();
    }
}

      

+1


source







All Articles