0

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...

3
Contributors
8
Replies
23
Views
2 Years
Discussion Span
Last Post by Mike Askew
0

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

0

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

0

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.

0

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

Edited by Mike Askew

1

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.

0

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!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.