Wednesday, 15 June 2011

asp.net - Owin SuppressDefaultHostAuthentication and existing HTTP Module -


In an existing ASP.NET MVC application, I have added WebAPI. I have used the most template code which is a new one Is generated from the project.

I have to face some issues related to authentication. I've added the API to avoid the usual login process:

  config.SuppressDefaultHostAuthentication (); Config.Filters.Add (New HostAuthenticationFilter (OAuthDefaults.AuthenticationType)); According to the default template,  

.

However, I get an error by calling my API: "There is no OYIN authentication manager related to the request."

I found out that the reason is that the custom HTTP module is active; Removing the module from the Web.config API works though the 'normal' web application requires this module.

Is there a way to connect the HTTP module with OVIN authentication?

The module is defined as such:

  Public class MGPContextInitializer module: IHttpModule {Public Zero Init (HttpApplication Reference) {if (context! = Null) {context.AcquireRequestState + = AcquireRequestState; Context.BeginRequest + = new EventHandler; }} Private Zero AcquireRequestState (Object Sender, EventArgs E) {If (HttpContext.Current.Session! = Faucet) {InitializeUserCulture (New HttpContextWrapper (HttpContext.Current) .GetSessionID ()); }} Private Zero BeginRequest (Object Sender, EventArgs E) {InitializeCustomer ((HttpApplication) Sender); } Private Static void InitializeInstantie (HttpApplication Application) {HttpContextBase ReferenceBase = New HttpContextWrapper (application.Context); Margadata RoadData = MargTab.Rout Geturoutadata (referencebase); If (Margaata! = Null) {var customer = Margaata Value ["customer"]; If (customer! = Null) {Initializer.InitializeCustomer (customer.ToString ()); }}}}  


No comments:

Post a Comment