c# - The resource cannot be found. Requested URL: /Area/Controller/undefined -
getting error shown below .. getting error way before code execution reaches homecoming view() or homecoming redirect action have areas set .. posting area registration section check if wrong there .. have checked spellings of folders , .. runs fine until there section gets info database via entity framework .. confused causing problem ..
the error getting
server error in '/' application.
the resource cannot found.
description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review next url , create sure spelled correctly.
requested url: /admin/home/undefined
version information: microsoft .net framework version:4.0.30319; asp.net version:4.0.30319.18408
//inside controller home .. under area admin
[httpget] [authorize] public actionresult show() { homecoming view(); } public actionresult login() { homecoming view(); } [httppost] [validateantiforgerytoken] public actionresult login(string rememberme, string username, string password) { authenticateuser authenticate = new authenticateuser(); if (authenticate.isuserauthentic(username,password)) { //the error page rendered here .. //even before reaching homecoming view portion or redirect action formsauthentication.setauthcookie(username, false); homecoming redirecttoaction("show"); } else { homecoming view(); } } dbcontext db = new dbcontext(); public bool isuserauthentic(string username,string password) { bool authentic = false; admin_users user = db.admin_users.singleordefault(u => u.user_name == username); if (user != null) { if (user.user_password == password) { authentic = true; } else { authentic = false; } } homecoming authentic; } public class adminarearegistration : arearegistration { public override string areaname { { homecoming "admin"; } } public override void registerarea(arearegistrationcontext context) { context.maproute( "admin_default", "admin/{controller}/{action}/{id}", new { controller = "home", action = "show", id = urlparameter.optional }, namespaces: new[] { "projectname.areas.admin.controllers" } ); } }
please allow me know if there else need share inorder create problem clearer
change default route in global asax because looking "index" method in "home" controller doesn't exists.
change action property from
new { controller = "home", action = "index", id = urlparameter.optional },
to if "login" default page
new { controller = "home", action = "login", id = urlparameter.optional },
c# asp.net asp.net-mvc entity-framework
No comments:
Post a Comment