ASP.net page does not open
Good afternoon, can you help me figure out the ASP.net code? I got it from a giant developer, the problem is that the "Admin" page does not open. That is, after starting the application - the default page "PlanEntuty" opens, because it tries to go to the "Administrator" page - an error 404 occurs, although everything is in place. If in the files "HomeController.cs" change in the line "return RedirectToAction("Index", "PlanEntity");" on "PlanAdmin" - the same error occurs
https://github.com/MixanM/PlanAUP
ASP.NET
-
AgaveJoe 26,166 Reputation points
2022-06-09T12:52:08.713+00:00 A 404 is the expected status code as there no PlanEntity controller. If you need help with the code that you received from a "giant developer" then you should ask the "giant developer" for assistance.
-
Yijing Sun-MSFT 7,071 Reputation points
2022-06-10T02:22:35.14+00:00 Hi @MihailM ,
A 404 error is you have loss something such as controller or view. Or maybe your path is wrong. Please shared your codes reference with your problems to us on this thread.
Best regards,
Yijing Sun -
MihailM 1 Reputation point
2022-06-10T03:30:39.92+00:00 Thank you for responding, here is a link to the project, rummaging through it, I found that the "controllers" most likely do not work. Tried to add "test" - and also "404 error"
https://drive.google.com/file/d/1q-WqwPCKLe_Wjj728de0-V6wfx-RYVLa/view?usp=sharing -
MihailM 1 Reputation point
2022-06-10T03:31:54.567+00:00 Sorry, English is not my native language, I meant the previous developer who has already retired
https://drive.google.com/file/d/1q-WqwPCKLe_Wjj728de0-V6wfx-RYVLa/view?usp=sharing
-
MihailM 1 Reputation point
2022-06-10T05:18:16.2+00:00 Open project whis: https://github.com/MixanM/MainBranch
-
Yijing Sun-MSFT 7,071 Reputation points
2022-06-10T05:27:10.577+00:00 Hi @MihailM ,
You don't understand your meanings. I want you could post code to show on this thread instead of the package. You just need post the codes about the problems. I can't find the codes about PlanEntity controller.
Best regards,
Yijing Sun -
MihailM 1 Reputation point
2022-06-10T06:05:25.233+00:00 Sorry, misunderstood you. Here is the code:
namespace PlanAUP.App_Start
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");//routes.MapHttpRoute( // name: "DefaultApi", // routeTemplate: "api/{controller}/{id}", // defaults: new { id = RouteParameter.Optional } //); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } }
}
//////
namespace PlanAUP.Areas.Default.Controllers { public class HomeController : DefaultController { public ActionResult Index() { //return View(); return RedirectToAction("Index", "PlanEntity"); } } }
-
MihailM 1 Reputation point
2022-06-10T06:15:46.083+00:00 using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Security;
using System.Web.Mvc;
using System.Web.Routing;
using PlanAUP.Global.Auth;
using PlanAUP.Models.Info;
using PlanAUP.Models.ViewModels;
using PlanAUP.Model;namespace PlanAUP.Areas.Default.Controllers
{
public class PlanEntityController : DefaultController
{
protected override void Initialize(RequestContext requestContext)
{
base.Initialize(requestContext);bool isAdmin = Checker.Check(PlanUserRole.Admin); bool isEditor = Checker.Check(PlanUserRole.Editor); ViewBag.Title = Auth.CurrentUser.lastName; ViewBag.canCreate = isAdmin || isEditor; ViewBag.canEdit = isAdmin || isEditor; ViewBag.canDelete = isAdmin; ViewBag.viewAll = isAdmin; ViewBag.CanViewAllType = isAdmin; } public ActionResult Index(PlanType filter = PlanType.Director) { var list = RepositoryIntranet.PlanEntity.Where(x => x.Type == filter).OrderByDescending(x => x.RealDate).Take(100); ViewBag.Filter = filter; return View(list.ToList()); } public ActionResult List(int page = 1, PlanType? filter = null) { var list = RepositoryIntranet.PlanEntity.Where(x=> (filter != null && x.Type == filter) || (filter == null) ).OrderByDescending(x=>x.RealDate); var data = new PageableData<PlanEntity>(); data.Init(list, page, "List"); return View(data); }
-
MihailM 1 Reputation point
2022-06-10T06:20:16.207+00:00 PlanEntity File
210134-new.txt -
Yijing Sun-MSFT 7,071 Reputation points
2022-06-10T09:40:10.203+00:00 Hi @MihailM ,
A 404 means you can't find the page. I have check your project, your folder are under the “Areas” folder. So, you need add "Areas" in the url path.Best regards,
Yijing Sun
Sign in to comment