Ich versuche Single Sign On zu verwenden, indem ich die OWIN-Bibliotheken verwende. Der Code, den ich habe, ist in MVC C#. Ich versuche, es in Form Web site in VB zu übersetzen. Hier ist der C# -Code, die funktioniert:Übersetzen von C# zu VB für OWIN Single Sign On
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseWsFederationAuthentication(
new WsFederationAuthenticationOptions
{
Wtrealm = realm,
MetadataAddress = metadata,
Notifications = new WsFederationAuthenticationNotifications
{
AuthenticationFailed = context =>
{
context.HandleResponse();
context.Response.Redirect("Home/Error?message=" + context.Exception.Message);
return Task.FromResult(0);
}
}
});
}
Und hier ist der VB.Net Code:
Public Sub ConfigureAuth(app As IAppBuilder)
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType)
app.UseCookieAuthentication(New CookieAuthenticationOptions())
Dim authOption As WsFederationAuthenticationOptions = New WsFederationAuthenticationOptions()
app.UseWsFederationAuthentication(New WsFederationAuthenticationOptions() With {
.Wtrealm = realm,
.MetadataAddress = metadata
})
End Sub
Ich glaube nicht, ich habe den UseWsFederationAuthentication
Code richtig übersetzt, da ich links aus Benachrichtigungen Zeug, wie ich nicht herausfinden konnte, wie man es übersetzt. Es wird kein Fehler ausgegeben, es wird jedoch nicht ordnungsgemäß authentifiziert. Kann mir jemand sagen, ob es ein Problem mit der Übersetzung gibt und wie man es beheben kann?