0

I would like to be able to use the global.asax file to redirect to a page regardless of what parameters come before a specific reference (the parameters can be ignored).

routes.MapPageRoute("ExportToExcel", "Initial/{any}/Number/{of}/{parameters}/ExportToExcel", "~/Views/Excel/ExportToExcel.aspx", true);

I thought I would be able to use a wildcard such as:

routes.MapPageRoute("ExportToExcel", "Initial/*/ExportToExcel.aspx","~/Views/Excel/ExportToExcel.aspx", true )

Is this possible?

1 Answers1

0

In the end I just made 2 rules, parameters in braces are ignored but hard coded paths need to be routed. Although I think using regular expressions and a routvaluedictionary you could change this should you need to.

routes.MapPageRoute("ExportToExcel", "Initial/{any}/ExportToExcel", "~/Views/Excel/ExportToExcel.aspx", true);
routes.MapPageRoute("ExportToExcel2", "Initial/{any}/Number/ExportToExcel", "~/Views/Excel/ExportToExcel.aspx", true);