admin管理员组文章数量:1128974
I have an ASP.NET webforms and a Web API that locally in IIS Express, automatically calls my custom identity server when user navigates to a specific web page, firing the OnRedirectToIdentityProvider
event.
If I publish this application to IIS, nothing happens (when users click on login link page, the code returns http 200 instead of triggering above mentioned event).
This is my code:
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
AuthenticationType = OpenIdConnectAuthenticationDefaults.AuthenticationType, //"oidc";
ClientId = WebConfigurationManager.AppSettings["ClientId"],
BackchannelTimeout = System.TimeSpan.FromMinutes(30),
CallbackPath = new PathString("/Account/Login"),
Authority = WebConfigurationManager.AppSettings["Authority"],
PostLogoutRedirectUri = WebConfigurationManager.AppSettings["PostLogoutRedirectUri"],
RedirectUri = WebConfigurationManager.AppSettings["RedirectUri"],
Scope = "openid profile",
ResponseType = "id_token",
SaveTokens = true,
Notifications = new OpenIdConnectAuthenticationNotifications
{
AuthenticationFailed = OnAuthenticationFailed,
SecurityTokenValidated = OnSecurityTokenValidated,
RedirectToIdentityProvider = OnRedirectToIdentityProvider,
MessageReceived = OnMessageReceived,
AuthorizationCodeReceived = OnAuthorizationCodeReceived,
TokenResponseReceived = OnTokenResponseReceived,
SecurityTokenReceived = OnSecurityTokenReceived,
}
});
app.UseStageMarker(PipelineStage.Authenticate);
I have an ASP.NET webforms and a Web API that locally in IIS Express, automatically calls my custom identity server when user navigates to a specific web page, firing the OnRedirectToIdentityProvider
event.
If I publish this application to IIS, nothing happens (when users click on login link page, the code returns http 200 instead of triggering above mentioned event).
This is my code:
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
AuthenticationType = OpenIdConnectAuthenticationDefaults.AuthenticationType, //"oidc";
ClientId = WebConfigurationManager.AppSettings["ClientId"],
BackchannelTimeout = System.TimeSpan.FromMinutes(30),
CallbackPath = new PathString("/Account/Login"),
Authority = WebConfigurationManager.AppSettings["Authority"],
PostLogoutRedirectUri = WebConfigurationManager.AppSettings["PostLogoutRedirectUri"],
RedirectUri = WebConfigurationManager.AppSettings["RedirectUri"],
Scope = "openid profile",
ResponseType = "id_token",
SaveTokens = true,
Notifications = new OpenIdConnectAuthenticationNotifications
{
AuthenticationFailed = OnAuthenticationFailed,
SecurityTokenValidated = OnSecurityTokenValidated,
RedirectToIdentityProvider = OnRedirectToIdentityProvider,
MessageReceived = OnMessageReceived,
AuthorizationCodeReceived = OnAuthorizationCodeReceived,
TokenResponseReceived = OnTokenResponseReceived,
SecurityTokenReceived = OnSecurityTokenReceived,
}
});
app.UseStageMarker(PipelineStage.Authenticate);
Share
Improve this question
edited Jan 8 at 21:04
marc_s
754k183 gold badges1.4k silver badges1.5k bronze badges
asked Jan 8 at 11:53
Daniele FrisennaDaniele Frisenna
195 bronze badges
1 Answer
Reset to default 1I found a solution by myself. All my code and related libraries wasn't have any problems. The working solution was to delete bad nested web config files located in the same directory where are present the destination link aspx file, that disable middleware redirect.
版权声明:本文标题:.net - OnRedirectToIdentityProvider does not fire when publish my ASP.NET webforms app on IIS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736732002a1950048.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论