asp.net - Convert Query string to Route Path -
i have issue , cant seem resolve it. have url, thats like:
myurl/?culture=fr
what want is
myurl/fr
my controller looks :
public actionresult index(string culture = null)
and routeconfig:
routes.maproute( name: "languages", url: "{controller}/{action}/{culture}" );
this results in page isn't redirecting properly. hints solve it?
give default controller , action in route if appending "fr" root of url(www.yoururl.com/fr). :-
routes.maproute( name: "languages", url: "{controller}/{action}/{culture}", defaults: new { controller = "home", action = "index"}
);
replace "home" default controller , "index" default action.
Comments
Post a Comment