locked
why id=0 when make it integer but if string it get value ? RRS feed

  • Question

  • User696604810 posted

    I work on asp.net core 2.2 really when assign value to id on url as id=5

    it display on debugging id=0 although i write value beside id 

    i write my URL as below 

     [HttpGet]
            [Route("GetAllFilters/{id}")]
            public IActionResult GetAllFilters(int id)
            {
    
                try
                {
                    //string[] s = id.Split('=');
                   
                   // int Reportid = Convert.ToInt32(s[1]);
                    var getfilters = _reportservice.GetReportFilter(id);
                   
                    return Ok(getfilters);
                }
                catch (Exception ex)
                {
    
                    return NotFound(ex.Message);
                }
    
            }

    I write on my URL as below 

    http://localhost:61265/api/GetAllFilters/report/id=5

    so why id=0 this is my question and how to solve that

    i send get request from google chrome browser  visual studio 2017

    Friday, May 1, 2020 10:42 PM

All replies