Привет Это мой фильтр действий, мне нужно определить размер экрана для перенаправления на адекватное действие, как это сделать?asp.net MVC4: как определить ширину экрана в фильтре Action?
public sealed class DetectViewFilterAttribute : ActionFilterAttribute
{
private readonly IRegistrationConfiguration _registrationConfiguration;
public DetectViewFilterAttribute()
{
_registrationConfiguration = DependencyResolver.Current.GetService<IRegistrationConfiguration>();
}
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
bool isMobile = false;
string userAgent = HttpContext.Current.Request.UserAgent.ToLower();
Regex mobileDetectionRegularExpression = new Regex(_registrationConfiguration.DetectMobileRegularExpression);
isMobile = mobileDetectionRegularExpression.IsMatch(userAgent);
if (isMobile)
{
String url;
UrlHelper helper = new UrlHelper(filterContext.RequestContext);
// TODO **if width de device between 300 and 600 px*
url = helper.Action("Mobile","Inscription");
else
url = helper.Action("Tablette","Inscription");
HttpContext.Current.Response.Redirect(url);
}
base.OnActionExecuting(filterContext);
}
}
маркетинговой службы просят сделать два разных вида для мобильных и tablette. Мне нужно определить ширину браузера на стороне клиента в устройстве – user1428798