user981508
user981508

Reputation:

Globally disable MVC mobile site from rendering

I have created a mobile version for an MVC website. For temporary purpose, I would like to disable the mobile site completely. Is there a setting that can be done in either web.config or global.asax to do this?

Upvotes: 2

Views: 736

Answers (1)

user981508
user981508

Reputation:

For anyone who needs a solution, I could disable mobile views in this way:

var mobileModel = DisplayModeProvider.Instance.Modes.FirstOrDefault(a => a.DisplayModeId == "Mobile");
if (mobileModel != null)
{
    DisplayModeProvider.Instance.Modes.Remove(mobileModel);
}

I adapted the solution from: Regular views don't work when we are on iPhone?

Upvotes: 4

Related Questions