2017-09-25 155 views
0

我有MVC應用程序,我嘗試訪問移動領域。太多的重定向錯誤(ASP.NET MVC)

所以我決定使用集成到chrome移動模式。

我的起動控制器是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配置我有與此相關的擴展的一些代碼,當我刪除了這一切還好