China Syndrome
China Syndrome

Reputation: 993

webforms using MVC routhing with Query string

I inherited a legacy webforms app that makes use of some nasty query string variables

I want to clean up the site using MVC routing, I can do this easy enough for some of the simple ones how

1 page alone call it Decision.aspx uses the following query strings.

City=Something
ShowMessages=true
CaseID = INT32
PersonID = INT32
SpectorKey = GUID

in some case the query string is a combination of many of these like enter code hereCity=Juno&ShowMessages=true&Personid=44

can anyone help me with this?

Upvotes: 0

Views: 45

Answers (1)

teo van kot
teo van kot

Reputation: 12491

Just to cleat routes you can add something like this to your RouteConfig

routes.MapPageRoute(
 "DecisionRoute",
 "Decision/{City}/{ShowMessages}/{CaseID}/{PersonID}/{SpectorKey}", //Your URL
 "~/Decision.aspx?City={City}&ShowMessages={ShowMessages}&CaseID={CaseID}&Personid={PersonID}&SpectorKey={SpectorKey}" //Actuall path
 );

Note that in case that i posted all your parameters should always be. If it is not you must think how to order this paremeters.

Upvotes: 0

Related Questions