There is a SiteMinder rule placed in to allow access to "/public/*" pages for unauthenticated users. But in my mvc folder structure there is no physical folder (or area) called "public" and I don’t want to do that as I should be able to add public pages freely in any area. Now, unauthenticated users will not have access to public pages (actions). So I need a workaround to get through SiteMinder for public pages.
There are two things in my mind that I need to find a solution.
Rewrite routes by prepending "/public" to them (conditionally may be based on Authorized attribute) for SiteMinder.
Once a url received with "/public" that should be routed to proper area/controller/action ignoring "/public" portion of it.
I still couldn’t figure out a way to code above. If you experts know how to achieve above or have different thoughts please post.
Cheers, moosila
Finally the question narrowed down to "How can I rewrite route with adding "/public" after the root and before the area/controller/action?"
I did a POC to achieve above with a help of my co-worker: Using reflection obtain appropriate controller name, action name and analysing namespace get the area name. Now we have new pattern with "/public".
routeUrlPattern = string.Format("public/{0}/{1}/{2}/{{id}}", areaName, controllerName, actionName);
RouteTable.Routes.Add(new Route(routeUrlPattern, new MvcRouteHandler())
Above routes should be added before non public routes in the the table to work for /public.