One of the controllers return 403 after publishing

607 views Asked by At

I have just publish my ASP.Net MVC application online .. but all the actions and controllers work fine for registered users.

only one of them return 403 .. ?

locally everything works perfectly.

Any debugging suggestion will be very helpful.. any ideas as well

I know its something with the routing engine .. as the direct url : /UserPortal/Portal/Portal works well = Area, = Controller, = Action

But when i use: /UserPortal/ It returns 403 ..

i have the following in my UserPortalAreaRegistration.cs

public override void RegisterArea(AreaRegistrationContext context) 
        {
            context.MapRoute(
                "UserPortal_default",
                "UserPortal",
                new { controller = "Portal", action = "Portal", id = UrlParameter.Optional }
            );

            context.MapRoute(
                "UserPortal_standard",
                "UserPortal/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
            );
        }
1

There are 1 answers

0
Alexander Polyankin On

It can be route template issue. Your first route's template is "UserPortal", but your url is "UserPortal/". So first route isn't matched. Try removing slash and see if it works. Also I suggest you to completely remove first route and add defaults to second one:

new { controller = "Portal", action = "Index", id = UrlParameter.Optional }