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

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -