Reputation: 9153
I have an MVC page that has a webforms page that it needs to render:
The virtual directory for the webforms page is:
http://mysite/Report/1
File saved:
~/Areas/Accounts/Views/Invoices/Report.aspx?id=1
How do I map this?
I have mapped it to controller:
return Redirect("~/Areas/Accounts/Views/Invoices/Report.aspx?id=1?id=" + id);
But I get an error.
Upvotes: 2
Views: 2831
Reputation: 57907
You want to use the MapPageRoute()
method to send something to a specific page:
routes.MapPageRoute(
"ReportRoute",
"Report/{id}",
"~/Areas/Accounts/Views/Invoices/Report.aspx?id={id}"
);
Upvotes: 3
Reputation: 19465
From the way you put it you might not be clear on what you're doing.
Add a Controller (from visual studio) in this folder : ~/Areas/Accounts/Controllers/Report
You would probably have a method display(int id)
in your ReportController
class. Then by default your URl will look like:
http://mysite/Report/display/1
To customize it you add this into Global.asax.cs
:
routes.MapRoute(
"NewRoute", // Route name
"report/{id}", // URL with parameters
new { controller = "report", action = "display", // Parameter defaults
id = UrlParameter.Optional }
);
Upvotes: 0