Redirecting from asp.net web form to mvc 4

i am in a subfolder called “paypal” and im trying to redirect to my mvc page. I have tried these 3 ways The page I am trying to redirect form is a webform

Response.Redirect("../../SubscriptionView/Success/" + pdt.TransactionId.ToString());

Response.Redirect("../SubscriptionView/Success/" + pdt.TransactionId.ToString());

Response.Redirect("~/SubscriptionView/Success/" + pdt.TransactionId.ToString());

and keep getting

HTTP Error 404.0 – Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

.com:80/paypal/subscriptionview/success/

See how the redirect has not moved up from the paypal directory? What am I doing wrong?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

I figured out how to get it working.

 UrlHelper urlHelp = new UrlHelper(HttpContext.Current.Request.RequestContext);
                    response.Redirect(urlHelp.Action("PaymentError", "SubscriptionView", new { mailId = mailId }));

This returned me from the aspx page that i needed process the response from paypal back to my controller

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply