Vb.net asp.net webforms identity server客户端-根据URL启用/禁用

Vb.net asp.net webforms identity server客户端-根据URL启用/禁用,vb.net,identityserver4,Vb.net,Identityserver4,我的客户端是一个asp.net webforms(.net 4.8)网站 我有两个应用程序在同一个站点上运行,我已将其配置为身份“客户端”-不理想,但没有其他方式:( 我想基本上使用AppA的身份验证,但不使用AppB-有没有办法在Startup.cs文件中动态启用/禁用Identity auth?我假设我可以获取HTTPContext并处理URI,但当我这样做时,它返回127.0.0.1作为URL,这不是我访问应用程序的方式 Public Class Startup Public Su

我的客户端是一个asp.net webforms(.net 4.8)网站

我有两个应用程序在同一个站点上运行,我已将其配置为身份“客户端”-不理想,但没有其他方式:(

我想基本上使用AppA的身份验证,但不使用AppB-有没有办法在Startup.cs文件中动态启用/禁用Identity auth?我假设我可以获取HTTPContext并处理URI,但当我这样做时,它返回127.0.0.1作为URL,这不是我访问应用程序的方式

Public Class Startup
    Public Sub Configuration(ByVal app As IAppBuilder)

    If IsAppA Then

        app.UseCookieAuthentication(New CookieAuthenticationOptions() With {
            .AuthenticationType = "Cookies",
            .ExpireTimeSpan = TimeSpan.FromMinutes(10),
            .SlidingExpiration = True
        })

        JwtSecurityTokenHandler.InboundClaimTypeMap.Clear()

        app.UseOpenIdConnectAuthentication(New OpenIdConnectAuthenticationOptions With {
            .AuthenticationType = "oidc",
            'Further settings etc.

    End If

这是因为您都在本地主机上托管,请尝试在IIS和HttpContext.Current.Request上分配IP