Think I am going mad here..

So I have a working website setup in IIS. This was all configured by a previous developer. We have a set of reports that you can browse to by going to localhost/Reports/ReportName, the underlying directory structure in IIS is actually Reports/Views/ReportName/index.cshtml. I have added a new report with the exact same setup as the others however when I navigate to the localhost/Reports/NewReportName URL I get a 404 and I am not quite sure what I am missing...

Recommended Answers

All 8 Replies

Haven't a clue where the route config is, I can see a RouteConfig.cs class but nothing of interest in it...

Your request should get there, perhaps you can debug/trace from there what happens. No idea otherwise. No rewrite rules set up?

Url rewrite isn't installed on these servers.

Will try and debug the routing stuff

Your missing route definitions. And probably a controller. Show us the content of your RouteConfig.cs and tell us what you have under the controllers folder.

RouteConfig.cs

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "ConfigJs",
            url: "DScripts/Config.js",
            defaults: new { controller = "General", action = "Config" }
        );


        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "General", action = "Index", id = UrlParameter.Optional }
        );
    }
}

Under the controllers folder I have
- GeneralController
- ReportControllerBase
- NewReportNameController

and the other existing controllers that all work fine.

The above RouteConfig appears to work for everything else

The route is proper. The problem should be at the controller. There should be methods in your reportscontroller that correspond with the report names. To add a new report you need to add a method with the name as your new report and put the logic to make it find and display the report.

Nailed it Toby.

Was missing some code within the Controller class for the specific report handling certain url actions. Now getting some errors around injection but I can resolve those hopefully. Will mark this as resolved.

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.