Click here to Skip to main content
15,891,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Problem

I have error 404 couldn't load resources when using post man to send post request to authunticationcontroller/PostUserLogin

I spend more time but in last not worked or not hit breakpoints on action PostUserLogin .

i move action PostUserLogin to controler MenuController and send post request by post man it worked and breakpoints hitted why this happen

what is wrong on my code

I need when put action PostUserLogin on Authunticationcontroller and send post request to authunticationcontroller/postuserlogin using post man breakpoint hit .

when put break point on menu controller action PostUserLogin then press click button for send post request breakpoint hitted and it work

but when using another controller name Authuntication and put action PostUserLogin on it and i put breakpoints for test it is not sending post by post man why

and display error 404 why and hot to solve this problem

why authunticationcontroller/postuserlogin not working or breakpoint hit .
why sending post request to function PostUserLogin on controller Authuntication Not working  why ?


What I have tried:

C#
public class ApiRoutes
{
public const string SecurityBase = "Security";
public static class Security
{
public const string GetUserMenus = SecurityBase + "/UserPrograms/{userId}";
}
//Api url For Login
public const string SecurityLogin = "Authuntication";
public static class Login
{
public const string UserLogin = SecurityLogin + "/login";

}
}


public class MenusController : Controller
    {
        readonly Services.ISecurityService _SecurityService;
        public MenusController(Services.ISecurityService securityService)
        {
            _SecurityService = securityService;
        }
        [HttpGet(Contracts.ApiRoutes.Security.GetUserMenus)]
        public IActionResult GetUserMenu(string userId)
        {
            string strUserMenus = _SecurityService.GetUserMenus(userId);
            return Ok(strUserMenus);
        }
        [HttpPost(Contracts.ApiRoutes.Login.UserLogin)]
        public IActionResult PostUserLogins([FromBody] Users user)
        {
}
public class MenusController : Controller
    {
        readonly Services.ISecurityService _SecurityService;
        public MenusController(Services.ISecurityService securityService)
        {
            _SecurityService = securityService;
        }
        [HttpGet(Contracts.ApiRoutes.Security.GetUserMenus)]
        public IActionResult GetUserMenu(string userId)
        {
            string strUserMenus = _SecurityService.GetUserMenus(userId);
            return Ok(strUserMenus);
        }
        [HttpPost(Contracts.ApiRoutes.Login.UserLogin)]
        public IActionResult PostUserLogins([FromBody] Users user)
        {
        }
Posted
Comments
Richard MacCutchan 7-Sep-19 5:14am    
Please stop using bold text. Everyone here is perfectly able to read normal fonts.
ahmed_sa 7-Sep-19 8:15am    
OK thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900