2017-09-25 11 views
0

私はMVCアプリケーションを持っており、モバイルエリアにアクセスしようとしています。リダイレクトエラーが多すぎます(ASP.NET MVC)

私は、Chrome to Mobileモードを使用することにしました。

マイスタートコントローラは、ここでAccount/Login

あるApplicationStart

protected void Application_Start() 
     { 
#if DEBUG 
      XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logging_DEBUG.config"))); 
#else 
      if (AppDomain.CurrentDomain.BaseDirectory.Contains("DevTrackerweb") 
       || AppDomain.CurrentDomain.BaseDirectory.Contains("Trackerweb4Test")) 
      { 
       XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logging_DEBUG.config"))); 
      } 
      else 
       XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logging.config"))); 
#endif 

      var log = LogManager.GetLogger(AppDomain.CurrentDomain.BaseDirectory); 
      log.Info("Application start"); 

      AreaRegistration.RegisterAllAreas(); 
      GlobalConfiguration.Configure(WebApiConfig.Register); 
      RouteConfig.RegisterRoutes(RouteTable.Routes); 
      BundleConfig.RegisterBundles(BundleTable.Bundles); 

      ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder()); 
      ModelBinders.Binders.Add(typeof(decimal?), new NullableDecimalModelBinder()); 

      Translator.Prefetch().Wait(); 

      HttpContext.Current.Application.Add("TrackerwebServiceStatus", TrackerwebServiceStatus.OK); 

      sitesByHostName = InitializeSites(); 
      mainCustomerIDByCustomerID = InitializeCustomerIDDictionary(); 
     } 

のコードで、私はそれを実行すると、私はこの問題を解決することができますどのようにこの

enter image description here

がありますか?

答えて

0

あなたのログインページ/アクションは匿名アクセス用に設定されていません。ログインアクションメソッドにAllowAnonymous属性を追加してみてください。

+0

私は確認することができますどのように\編集、それを削除したとき? –

+0

https://stackoverflow.com/questions/9727509/how-to-allow-an-anonymous-user-access-to-some-given-page-in-mvc 例: –

+0

はい、AllowAnonymous'属性を使用してください – Moho

0

問題はそれがレガシーコードであり、私が削除したMvcSiteMap拡張があるという点です。 Web構成で

私は、この拡張機能に関連するいくつかのコードを持っていたし、私はそれをすべて大丈夫

関連する問題