Posts

Showing posts with the label MVC

Mobile Device Detection ASP.NET

In ASP.NET, you can easily detect the mobile device request using Request.Browser.IsMobileDevice property and Request.UserAgent. The following code checks the IsMobileDevice property and redirects to the mobile specific page: protected void Page_Load(object sender, EventArgs e) { if (Request.Browser.IsMobileDevice) { Response.Redirec("~/default_mobile.aspx"); } } In MVC3 exposes an IsMobileDevice flag in the Request.Browser object. So in your razor code, you can query this variable and render accordingly. For example, @if (Request.Browser.IsMobileDevice) { HTML here for mobile device } else { HTML for desktop device }

Get absolute URL on Javascript MVC 4

to get absolute URL on Javascript @Url.Action("Numbers","Home"),

deployment - Deployed ASP.NET MVC 4

Update runAllManagedModulesForAllRequests to true in web.config: ...