If user hits http://somewebsite/Cnt but i dont have controller with that name and i would like to redirect user to http://somewebsite/Country. Same way if user hits /ofr then i will redirect him to /Offer.
How do i do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, you could create
RouteHandlerthat would handle shortened routes – to not repeat entire code ofMvcHandler, you could just derive from it and replace RouteData[“controller”], and letMvcHandlerexecutethan just register this handler instead of MvcHandler (this is registered by default for all mvc routes)
If you do not want all the requests to pass additional check whether they are shortened or not, you could create another route and set constraints for its {controller} value