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

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -