Click here to Skip to main content
15,566,625 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can you help me to identify the request is from application or mobile browser?

What I have tried:

I did not got anything yet. I was Request.UserAgent. But did not know how to proceed with this.
Posted
Updated 16-Feb-17 22:26pm

Can you try this code in BasePublicController.cs


protected override ViewResult View(IView view, object model)
{
return base.View(view, model);
}

protected override ViewResult View(string viewName, string masterName, object model)
{

string action = this.ControllerContext.RouteData.Values["action"].ToString();
if (Request.Browser.IsMobileDevice && Request.HttpMethod == "Get")
{
Response.Write("mobile");
return View(action);

}
else
{
Response.Write("desktop");
return View(action);
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900