Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help,if custom RouteConfig,the 'area' parameter not work in asp.net mvc #49

Open
ma7x opened this issue Oct 20, 2015 · 5 comments
Open

Comments

@ma7x
Copy link

ma7x commented Oct 20, 2015

file:App_Start/RouteConfig.cs

namespace XXXXXXX
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.LowercaseUrls = true;
            routes.MapRoute(
               name: "Default",
               url: "{area}/{controller}/{action}/{id}",
                //defaults: new { controller = "Default", action = "Index", area = "000000", id = UrlParameter.Optional },
               defaults: new { controller = "Home", action = "Index", area = "000000", id = UrlParameter.Optional },
               constraints: new { area = @"\d{6}" }
            );
        }
    }
}

then

[DonutOutputCache(Duration = 300, VaryByCustom = "area")]
public ActionResult Index(int area)
{
    return View();
}

then

it is not work,how to do?

@ma7x ma7x changed the title help,if custom help,if custom RouteConfig,the 'area' parameter not work Oct 20, 2015
@ma7x
Copy link
Author

ma7x commented Oct 20, 2015

any body the same question like me? I try to fix the question a lot of days ,but not work , headache!

@ma7x ma7x closed this as completed Oct 20, 2015
@ma7x ma7x reopened this Oct 20, 2015
@ma7x ma7x changed the title help,if custom RouteConfig,the 'area' parameter not work help,if custom RouteConfig,the 'area' parameter not work in asp.net mvc Oct 20, 2015
@moonpyk
Copy link
Owner

moonpyk commented Oct 20, 2015

Don't specify the VaryByCustom for area, MvcDonutCaching handles areas natively

@ma7x
Copy link
Author

ma7x commented Oct 21, 2015

thanks reply.
it's not area ,it's like id,
I have many url like

http://localhost/000000/home/index
http://localhost/110000/home/index
http://localhost/210000/home/index
http://localhost/310000/home/index
...
http://localhost/312345/home/index

you can new webapplication and copy the routeconfig ,
[DonutOutputCache(Duration = 300, VaryByCustom = "area")] to the home/index controller
it is not work, change the 'area' to 'somecustomparm' is the same result

@moonpyk
Copy link
Owner

moonpyk commented Oct 21, 2015

Just remove the VaryByCustom part dude, it has another meaning than the one you think

@ma7x
Copy link
Author

ma7x commented Oct 22, 2015

I have tried,not work .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants