I have an application that will support multiple sites. The site will be determined based on the url.
For example
http://myapp/site/abc123/…
and
http://myapp/site/xyz123/…
The site code will drive a lot of the functionality for example themes, available modules, etc…
Questions:
1-)I need to validate the site code is valid and if it isn’t, it should direct the user to an info page. I was looking at using IRouteConstraint, is this appropriate? Are there other/better options?
2-)Any gotchas with this approach (using url to identify site)? Is there are better approach?
Solution
I ended up creating a Custom ActionFilter and check the sitecode in the OnActionExecuting event. That seems to work well and fit better than the IRouteConstraint.
I ended up creating a Custom ActionFilter and check the sitecode in the OnActionExecuting event. That seems to work well and fit better than the IRouteConstraint.