The topic error shows when I add the method in common controller and call that method from Header view file which is located under the Theme => View => Shared in nopcommerce 3.80 .
Here is my method which I call from common controller
public ActionResult MobileBrowser()
{
var browser = Request.Browser;
System.Web.HttpBrowserCapabilitiesBase myBrowserCaps = browser;
if (((System.Web.HttpBrowserCapabilitiesBase)myBrowserCaps).IsMobileDevice)
{
ViewBag.Message = "mob";
}
else
{
ViewBag.Message = "web";
}
return View();
}
Here is the View file of MobileBrowser method
@if (ViewBag.Message == "mob")
{
Mobile
}
@if (ViewBag.Message == "web")
{
Web
}
Here is the Header.cshtml from where I calling MobileBrowser method from common controller
@Html.Action("MobileBrowser", "Common")
I got the solution, I code the partialview in the replace of view . Special Thankx to Tetsuya Yamamoto for the suggestion.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.