asp.net - How to get redirection to /Account/Login working with specific route configuration -



asp.net - How to get redirection to /Account/Login working with specific route configuration -

i have scenario have routes prefixed country code, e.g. http://www.example.com/us/home - country code used store country-specific info in session. working fine except unauthenticated requests (e.g. polling ajax requests fire after session has expired, or user leaves browser open long periods of time during , after deployments), @ point scheme seek , redirect /account/login, instead of country specific url, e.g. /us/account/login. because /account/login not valid route scheme throws the controller path '/account/login' not found or not implement icontroller. exception.

first prize able @ redirect country-specific e.g. /us/account/login, not possible work /account/login. if add together in route /account/login gets superseded defaultcountrycode route (if placed below in route configuration), or supersedes defaultcountrycode route (if placed below in route configuration).

route configuration

// if placed here supersedes defaultcountrycode route //routes.maproute("account", "/account/login"); // e.g. http://www.example.com/us/home routes.maproute("defaultcountrycode", "{countrycode}/{controller}/{action}/{id}", new { controller = "home", action = "index", id = urlparameter.optional }); // if placed here gets superseded defaultcountrycode route //routes.maproute("account", "/account/login");

have looked attribute routing instead? can create controller , have 2 actions -

one called when have "us/accounts/login/{id}" , other 1 can have attribute "accounts/login."

asp.net asp.net-mvc routes

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -