What I want to do : is to add prefix after action name, so that the browser's url bar can be seen like.
http://stackoverflow.com/ask
↓↓↓↓
http://stackoverflow.com/ask.mon
And also want to invoke a specific controller with the prefix as well.
http://stackoverflow.com/loginProcess.mon
If invoking like above, then below action can be called.
UPDATED : ( remember, I don't want to show my controller's name on the url bar. )
public Class LoginController : Controller
{
public ActionResult loginProcess() {
return View();
}
}
.
.
What I did : set up route config like this below.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{action}.mon/{id}",
defaults: new { controller = "Login", action = "Index", id = UrlParameter.Optional }
);
}
and the controller looks like...
public class LoginController : Controller
{
public ActionResult Index()
{
if (Session["userInfo"] != null)
{
return RedirectToAction("Main", "Web");
}
else
{
return View();
}
}
.
.
.
What happened : Throws me 404 error.
What should I do to avoid this?