Home > Articles > Details

[Solved] cannot apply indexing with [] to an expression of type QueryString


Questions: Am trying to get the data from an Asp.Net Core Request Query String but the compiler won't let me. It shows a red squiggly line saying "cannot apply indexing with [] to an expression of type QueryString". 

Login to See the Rest of the Answer

Answer:
If you are using Request.QueryString["Name"] change it to Request.Query["Name"]. Let me know if this helps.

According to Intellisense, The Request.QueryString is used to set or get query string used to create a query collection in Request.Query. While Request.Query gets the query value collection parsed from the Request.QueryString.


If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.


© 2022 - ErnesTech - Privacy