mercredi 29 avril 2020

Request["key"] is not working in C# web application (ASP.NET Core)

I am trying to get parameter form a View and passing it to the controller:

 [HttpPost]
 public string GetWord()
 {
     string word = Request["word"];
     return word;
 }

But I got an error

Indexing using the [] construct cannot be used for an Http Request expression

I looked at documentation and I don't know why it is not working. What should I do to fix this?




Aucun commentaire:

Enregistrer un commentaire