I have tried to check the browser in RouteConfig.cs file, but its showing error that didn't get the request from browser.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
string browser = HttpContext.Current.Request.Browser.Browser;
if (browser == "Chrome" || browser == "Firefox")
{
routes.MapRoute(name: "Default",
url: "{controller}/{action}/{id}",
defaults: new
{
controller = "Login",
action = "Index",
id = UrlParameter.Optional
});
}
}
My goal is to access applications only from chrome and firefox, so I have tried to check it in RouteConfig to re-route to another view if condition not satisfied. But it's not working so I have checked with Global.asax but the routing is not working there.