Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the name configureauth does not exist

i'm trying this tutorial http://httpjunkie.com/2013/311/adding-mvc-5-identity-to-an-existing-project/ but is shows me an error Error 5 The name 'ConfigureAuth' does not exist in the current context
this is my startup.cs class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Microsoft.Owin;
using Owin;

[assembly: OwinStartupAttribute(typeof(TicketSystem.Startup))]
namespace TicketSystem
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
        }



      }
    }

this is Startup.Auth.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Web.Mvc;

using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
namespace TicketSystem.App_Start
{
    public partial class Startup
    {

        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Enable the application to use a cookie to store information for the signed in user
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            // clientId: "",
            // clientSecret: "");

            //app.UseTwitterAuthentication(
            // consumerKey: "",
            // consumerSecret: "");

            //app.UseFacebookAuthentication(
            // appId: "",
            // appSecret: "");

            //app.UseGoogleAuthentication();
        }
    }
}
like image 458
usesser Avatar asked Jan 08 '23 10:01

usesser


1 Answers

You have different namespaces in both files: namespace TicketSystem.App_Start and namespace TicketSystem. Make sure they are the same. Or alternatively add using statement: using TicketSystem.App_Start in your startup.cs class. If you check the example you'll see that both files are using the same namespace (namespace MVC5FullApp)

like image 138
Milen Avatar answered Jan 16 '23 02:01

Milen