I have the following class on an ASP.NET MVC 5 site:
[assembly: OwinStartup(typeof(MVCSite.Startup))]
namespace MVCSite {
public partial class Startup {
public void Configuration(IAppBuilder application) {
application.UseCookieAuthentication(new CookieAuthenticationOptions {
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
application.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}
}
}
And on Web.Config I have the following:
<add key="owin:AutomaticAppStartup" value="false"/>
I have a breakpoint inside Startup.Configuration but this does not fire ...
Any idea why?
Create an ASP.NET Web App using OWIN Startup Add an OWIN startup class. In Visual Studio 2017 right-click the project and select Add Class. - In the Add New Item dialog box, enter OWIN in the search field, and change the name to Startup. cs, and then select Add.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web. config. To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.
Yes, Startup.Auth.cs comes to support OWIN authentication. While creating the application, by default Individual User Account will be selected and hence you get those files. if you want no authentication then while creating new project under Configure Authentication button select No Authentication.
It's usually happend because SystemWeb package is not installed on your project.
Use this command at your Package Manager Console:
Install-Package Microsoft.Owin.Host.SystemWeb
In the other hand you may use this configuration on your app.config or web.config if the above solution is not work:
<appSettings>
<add key="owin:AutomaticAppStartup" value="true"/>
</appSettings>
Using
<add key="owin:AutomaticAppStartup" value="true"/>
Is the answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With