We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d4a15a commit e0f32ddCopy full SHA for e0f32dd
src/React.Router/HtmlHelperExtensions.cs
@@ -102,7 +102,12 @@ public static IHtmlString ReactRouter<T>(
102
{
103
var response = htmlHelper.ViewContext.HttpContext.Response;
104
var request = htmlHelper.ViewContext.HttpContext.Request;
105
- path = path ?? request.Path.ToString() + request.QueryString;
+ var queryString = request != null && request.QueryString != null ? request.QueryString.ToString() : "";
106
+ if (!string.IsNullOrWhiteSpace(queryString) && !queryString.StartsWith("?"))
107
+ {
108
+ queryString = $"?{queryString}";
109
+ }
110
+ path = path ?? request.Path.ToString() + queryString;
111
112
var reactComponent
113
= Environment.CreateRouterComponent(
0 commit comments