Reputation: 2057
I am trying to setup a map routing using the Web.Routing and Web.MVC. The issue is that I need to be able to grab a potion of an incoming URL so an i can re route the user. i have my MapRoute url grabbing the entire string but since the url has a ? within it, it does not grab the entire string. More specifically, it does not grab anything after the occurrance of the ?. Is there any way to get past this?
Here is my maproute:
routes.MapRoute(
name: "OldEmailLink",
url: "{tag}",
defaults: new { controller = "ApIssues", action = "Task", id = UrlParameter.Optional }
);
When I debug this, I can get redirected to the action just that the string value of tag is:
default.asp
When tag should be:
default.asp?etaskid=32698
Given this url:
http://localhost1853:/accounting/ap/default.asp?etaskid=32698
Upvotes: 0
Views: 382
Reputation: 807
Try this for the controller.
public class ApIssuesController : Controller
{
public ActionResult Task(Int32 etaskid)
{
}
}
And this as the Route Config
routes.MapRoute(
name: "OldEmailLink",
url: "accounting/ap/default.asp",
defaults: new { controller = "ApIssues", action = "Task", id = UrlParameter.Optional }
);
Upvotes: 1