Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Cannot Convert from Http.QueryString to System.collections.IEqualityComparer

$
0
0

I want to get List of All QueryString to Append in the URL the below code works perfectly in asp.net mvc but when I move it to Asp.net Core the second line of the method shows me an error

"annot convert from Micorosoft.AspNetCore.Http.QueryString to System.Collection.IEqaulityComparer"

void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext)
    {

           var req = filterContext.HttpContext.Request;

           var queryStringParams = new NameValueCollection(req.QueryString);

                foreach (string x in queryStringParams)
                {
                    if (controllerName.Equals("Company") && queryStringParams.AllKeys.Length > 1)
                    {
                        if (x.Equals("typ"))
                        {
                            if (!string.IsNullOrEmpty(param))
                                param = "&" + param;
                            param = x + "=" + queryStringParams[x];

                            break;
                        }
                    }

                    if (!string.IsNullOrEmpty(param) && !param.Equals("q"))
                    {
                        if (!string.IsNullOrEmpty(param))
                            param = "&" + param;
                        param = x + "=" + queryStringParams[x];
                    }



                    base.OnActionExecuting(filterContext);
                }
            }
        }

    }


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>