Reputation: 1714
I am trying to create an MVC link via Url.Action inside my Web API Controller
string scheme = Request.RequestUri.Scheme;
System.Web.Mvc.UrlHelper helper = new System.Web.Mvc.UrlHelper();
string linkBackUrl = helper.Action("TestAction", "TestController", new{ code=code1, code2 = code2}, scheme);
And I am getting the error (when debugging) on the line linkBackUrl:
attempted to read or write protected memory. this is often an indication that other memory is corrupt.
Is there another way to create the linkBackUrl inside the Web API controller?
Upvotes: 0
Views: 611
Reputation: 2830
I think this is what your looking for :
string linkBackUrl = Url.Action("TestAction", "TestController", new { code = code1, code2 = code2 });
Or on your view:
<button onclick="window.history.back();">Go Back</button>
Upvotes: 1