Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我发现某些设备没有自动重定向到 .Mobile.cshtml 对应项。有没有办法通过 HttpContext.GetOverriddenBrowser 方法解决这个问题或根据屏幕分辨率强制移动?
你可以尝试添加一小段 Javascript 来创建一个带有 Javascript 的 cookie
window.screen.availHeight window.screen.availWidth
然后在服务器端检查 _PageStart.cshtml 中的 cookie(在返回每个页面之前运行),如果它满足您的要求,请使用
HttpContext.SetOverriddenBrowser(BrowserOverride.Mobile)