Last post Jan 01, 2021 12:38 AM by Prinx100
Member
1 Points
10 Posts
Aug 22, 2018 08:28 AM|talk2ekpa|LINK
Star
9831 Points
3120 Posts
Aug 23, 2018 10:09 AM|Brando ZWZ|LINK
Hi talk2ekpa,
As far as I know, the GlobalFilters object is a great way to associate an attribute with every Action method in your ASP.NET MVC application.
Normally, this line is inside global.asax in MVC.
More details, you could refer to below article:
https://visualstudiomagazine.com/articles/2017/06/02/aspnet-mvc-global-filters-handleerror.aspx
https://stackoverflow.com/questions/26347071/what-is-the-purpose-of-filterconfig-registerglobalfiltersglobalfilters-filters
Best Regards,
Brando
None
0 Points
2 Posts
Jan 01, 2021 12:38 AM|Prinx100|LINK
Give GlobalFilters a try ... they can be effective when used to associate an attribute with every Action method in your ASP.NET MVC application.
Member
1 Points
10 Posts
How to Add RedirectToCanonicalUrlAttribute filter in MVC-5
Aug 22, 2018 08:28 AM|talk2ekpa|LINK
I'm trying to add RedirectToCanonicalUrlAttribute filter in MVC 5 app. Got the code below from another site. It is
GlobalFilters.Filters.Add(new RedirectToCanonicalUrlAttribute(
RouteTable.Routes.AppendTrailingSlash,
RouteTable.Routes.LowercaseUrls));
But I don't know how or the specific place to add it on my server. Please any help?
Star
9831 Points
3120 Posts
Re: How to Add RedirectToCanonicalUrlAttribute filter in MVC-5
Aug 23, 2018 10:09 AM|Brando ZWZ|LINK
Hi talk2ekpa,
As far as I know, the GlobalFilters object is a great way to associate an attribute with every Action method in your ASP.NET MVC application.
Normally, this line is inside global.asax in MVC.
More details, you could refer to below article:
https://visualstudiomagazine.com/articles/2017/06/02/aspnet-mvc-global-filters-handleerror.aspx
https://stackoverflow.com/questions/26347071/what-is-the-purpose-of-filterconfig-registerglobalfiltersglobalfilters-filters
Best Regards,
Brando
None
0 Points
2 Posts
Re: How to Add RedirectToCanonicalUrlAttribute filter in MVC-5
Jan 01, 2021 12:38 AM|Prinx100|LINK
Give GlobalFilters a try ... they can be effective when used to associate an attribute with every Action method in your ASP.NET MVC application.