2016-11-07 82 views
0

當我在我的web.config中有以下密鑰,umbraco預覽工作正常,顯示正確的內容,但我無法登錄到我的網站,我可以登錄到umbraco後臺沒有任何問題。Umbraco預覽不顯示正確的內容

當我註釋掉以下密鑰時,我可以登錄到我的網站,但是這次umbraco預覽沒有顯示正確的內容。

我該如何做預覽工作,同時我可以登錄到我的前端網站?我已經在尋找一個解決方案,但我還沒有設法解決這個問題。任何幫助表示讚賞。

一把umbraco版本7.4.3組裝:1.0.5948.18141

的關鍵:

<add key="owin:appStartup" value="UmbracoDefaultOwinStartup" /> 

我OwinStartup類:

[assembly: OwinStartup(typeof(OwinStartup), "Configuration")] 
namespace ABC.XYZ.Site 
{ 
    public class OwinStartup : UmbracoDefaultOwinStartup 
    { 
     public override void Configuration(IAppBuilder app) 
     { 
      base.Configuration(app); 

      app.UseCookieAuthentication(new CookieAuthenticationOptions 
      { 
       AuthenticationType = "Cookies" 
      }); 

      app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions()); 


      app.Use((context, next) => 
      { 
       var loggedInMarkerCookie = context.Request.Cookies[Settings.CookieLoggedInMarkerName]; 
       var autoLoginAttempt = context.Request.Cookies[Settings.CookieLoggedInMarkerAttemptName]; 

       if (!context.Authentication.User.Identity.IsAuthenticated && !context.Request.Path.Value.StartsWith("/sso/") && (loggedInMarkerCookie != null && autoLoginAttempt == null)) 
       { 
        context.Response.Cookies.Append(Settings.CookieLoggedInMarkerAttemptName, DateTime.Now.ToString(), new CookieOptions { Expires = DateTime.Now.AddMinutes(30) }); 
        context.Authentication.Challenge(); 
       } 

       return next.Invoke(); 
      }); 
     } 
    } 
} 

回答

1

您的應用程序設置需要:

<add key="owin:appStartup" value="ABC.XYZ.Site, OwinStartup" /> 

和l在source處打個招呼我認爲在添加自定義配置後需要撥打base.Configuration(app);

+0

感謝賈森的答案,一個爲您的時間來回答這個問題,但不幸的是你的建議並不能解決我的問題。 –

+0

我認爲你的應用程序設置是錯誤的,參見上文。 –