実機モバイル環境
http://[IPアドレス]:[ポート番号]/で表示できるようにする
ファイアウォールを無効化する
1.IIS Express で localhost 以外からアクセスする方法
http://architect-wat.hatenablog.jp/entry/20130513/1368425906
2.コントロールパネル▶システムとセキュリティ▶Windowsファイアウォール▶Windowsファイアウォールの有効化または無効化
リスト4-77
Imports System.Web.WebPages
Public Class MvcApplication
Inherits System.Web.HttpApplication
Protected Sub Application_Start()
・・・中略・・・
DisplayModeProvider.Instance.Modes.Insert(0, New DefaultDisplayMode("iPhone") With
{.ContextCondition = Function(c) c.Request.UserAgent.IndexOf("iPhone") >= 0})
'Androidを追加してみる(大文字小文字を区別すること)
DisplayModeProvider.Instance.Modes.Insert(1, New DefaultDisplayMode("Android") With
{.ContextCondition = Function(c) c.Request.UserAgent.IndexOf("Android") >= 0})
End Sub
End Class
コントローラー側でUserAgentが確認できる
Function Contact() As ActionResult
ViewData("Message") = "Your contact page."
Debug.WriteLine(Request.UserAgent)
Return View()
End Function
参考
//userAgent(ユーザーエージェント一覧)