Home .Net Application Not Recognizing New Controller
Reply: 2

.Net Application Not Recognizing New Controller

DMop
1#
DMop Published in 2017-11-14 18:31:58Z

I added a new controller to a fresh .Net application and that controller does not seem to be able to be accessed by the application. My controller is called LoginController.cs. When I enter debug mode and navigate my browser to http://localhost:xxxxx/logincontroller, I get a 404 error. Trying to change my default page to this page did not work either.

Is there a specific way I have to link my page to my project?

The loginController is defined as follows:

namespace OliviaWebsite.Controllers
{
    public class LoginController : Controller
    {
        // GET: /<controller>/
        public IActionResult Index()
        {
            return View();
        }

        public string Welcome()
        {
            return "This is the Welcome action method...";
        }
    }
}

And it was added to the Controllers folder with HomeController.cs, which was working.

DMop
2#
DMop Reply to 2017-11-14 18:50:43Z

The correct URL should have been localhost.xxxxx/login

Tazbirul Haque
3#
Tazbirul Haque Reply to 2017-11-14 19:35:38Z

you should write localhost:port/controller/action In this case you have to use localhost:36888/Login/Index

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.381049 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO