@@ -199,7 +199,7 @@ static IDictionary<string, object> ObjectToDictionary(object value)
199
199
public static string Current ( this UrlHelper helper , object routeValues = null , bool includeQueryString = false )
200
200
{
201
201
RouteValueDictionary values = new RouteValueDictionary ( ) ;
202
-
202
+ StringBuilder arrayVals = new StringBuilder ( ) ;
203
203
foreach ( KeyValuePair < string , object > value in helper . RequestContext . RouteData . Values )
204
204
{
205
205
if ( value . Value != null )
@@ -212,7 +212,9 @@ public static string Current(this UrlHelper helper, object routeValues = null, b
212
212
// values[value.Key] = (DateTime)value.Value; -- BAD: can't unbox a value type as a different type
213
213
values [ value . Key ] = Convert . ChangeType ( value . Value , typeof ( DateTime ) ) ;
214
214
else if ( t . IsArray || t . IsSubclassOf ( typeof ( IEnumerable ) ) )
215
- values [ value . Key ] = string . Join ( "," , ( ( IEnumerable ) value . Value ) . Cast < object > ( ) ) ;
215
+ {
216
+ arrayVals . Append ( string . Join ( "&" , ( ( IEnumerable ) value . Value ) . Cast < object > ( ) . Select ( x=> value . Key + "=" + x . ToString ( ) ) ) ) ;
217
+ }
216
218
}
217
219
}
218
220
@@ -239,7 +241,12 @@ public static string Current(this UrlHelper helper, object routeValues = null, b
239
241
}
240
242
}
241
243
242
- return helper . RouteUrl ( values ) ;
244
+ var route = helper . RouteUrl ( values ) ;
245
+ if ( arrayVals . Length > 0 )
246
+ {
247
+ route += ( route . Contains ( "?" ) ? "&" : "?" ) + arrayVals . ToString ( ) ;
248
+ }
249
+ return route ;
243
250
}
244
251
245
252
static readonly PropertyInfo _instrumentationService = typeof ( WebPageExecutingBase ) . GetProperty ( "InstrumentationService" , BindingFlags . NonPublic | BindingFlags . Instance ) ;
0 commit comments