As a beginner in MVC I'm trying to figure out what's the best way to accomplish a route for my needs, and I'm getting no luck at all, so I'm kindly ask for any help
My webApp is driven by Calendars, and per each Calendar there are a bunch of actions
- Subscribe
- Edit Calendar
- View Winners
- Daily Challenge
- etc...
and I would like to avoid passing something like
mydomain.com/calendar/2
my idea would be to hide the ID
so no one can have logical access to other calendars, for example
mydomain.com/q2tsT
where q2tsT
could be a 10 char random generated string and then I would like to have routes such as:
mydomain.com/q2tsT/subscribe
mydomain.com/q2tsT/daily-challenge
mydomain.com/q2tsT/winners
mydomain.com/q2tsT/prizes
How would I set up my Route to perform like this?
something like:
routes.MapRoute(
"CalendarRoute",
"{calendar}/{controller}/{action}/{id}",
new {
calendar = "Empty",
controller = "Frontend",
action = "Index",
id = UrlParameter.Optional }
);
but what will I do with the calendar
? where do I pick it up so I can convert to an ID so querying the DB would be faster
I'm kinda lost here :(