0

A site uses this link format for everything:

  • example.com/?article=123
  • example.com/?category=456
  • example.com/?article=789&picture=012

An ASP classic default.asp catches all of this and does stuff with it.

I would really like to create a couple of routes for these old type of Url's with querystrings on the root, so I can catch them in a separate controller and do some tricks on them (permanent redirects).

When I try to create a route that contains a questionmark, I am told that is not possible.

Kjensen
  • 12,447
  • 36
  • 109
  • 171

1 Answers1

1

This could be a good case for Global Action Filters if there's no way to handle these using routes (Although I imagine there is).

You could process the incoming url in the OnActionExecuting method and redirect as appropriate.

UPDATE

There's a good SO answer here on how to redirect as you require. It may not be exactly as you've asked however a similar principle should acheive what you're after quite easily.

Community
  • 1
  • 1
Jamie Dixon
  • 53,019
  • 19
  • 125
  • 162