locked
Cannot Configure Properly the Startup.vb File and Owin Package seem not to work properly RRS feed

  • Question

  • User-1352156089 posted

    Hi All,

    I am trying to configure my app following the following steps (https://docs.microsoft.com/it-it/aspnet/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project) in order to create a user authentication system with Asp.net identity.

    The problem I am experiencing relates to the creation of the Startup.vb file.

    1st Problem: in the Add Item section I cannot find the pre-compiled Owin Class. So I created the below on my own: 

    Imports Microsoft.AspNet.Identity
    Imports Microsoft.Owin
    Imports Microsoft.Owin.Security.Cookies
    Imports Owin
    <Assembly: OwinStartup(GetType(ChannelManager.Startup))>
    Namespace ChannelManager
    Public Class Startup
    Public Sub Configuration(ByVal app As IAppBuilder)
    app.UseCookieAuthentication(New CookieAuthenticationOptions With {
    .AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
    .LoginPath = New PathString("/Login")
    })
    End Sub
    End Class
    End Namespace

    2nd Problem: since my Solution/Project is named ChannelManager, the system throws the following errors:

    • "ChannelManager" is ambiguous in the namespace "ChannelManager"
    • Class "ChannelManager" and namespace "ChannelManager" conflict in namespace "ChannelManager

    I downloaded the following packages: 

    • EntityFramework 
    • Microsoft ASP.NET Identity Core
    • Microsoft.AspNet.Identity.Owin
    • Microsoft.Aspnet.Owin.Host.SystemWeb

    I also added in my web.config file the following: 

    <appSettings>
        <!-- <add key="owin:AutomaticAppStartup" value="False" />  -->
        <add key="owin:AutomaticAppStartup" value="True" />
      </appSettings>

    Would someone help me in finding where the problem could be?

    Thank you,
    Claudio

    Friday, March 1, 2019 12:18 PM

All replies

  • User1724605321 posted

    Hi Claudio7810 ,

    Where do you create the Startup.cs file ,  and which line threw the conflict error ?

    Best Regards,

    Nan Yu

    Monday, March 4, 2019 6:24 AM