# MVC Core 6.0 Trying to get the example work

**URL:** <https://community.auth0.com/t/mvc-core-6-0-trying-to-get-the-example-work/96452>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, auth0net\
**Created:** [December 14, 2022, 2:58pm UTC](https://community.auth0.com/t/mvc-core-6-0-trying-to-get-the-example-work/96452 "2022-12-14T14:58:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gperrier](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gperrier/32/33195_2.png) [@gperrier](https://community.auth0.com/u/gperrier)\
**Post date:** [December 14, 2022, 2:58pm UTC](https://community.auth0.com/t/mvc-core-6-0-trying-to-get-the-example-work/96452/1 "2022-12-14T14:58:25Z")

</div>

Hello,  
I’m trying to reproduce this example :

> **[Auth0 ASP.NET Core MVC SDK Quickstarts: Add Login to your ASP.NET MVC...](https://auth0.com/docs/quickstart/webapp/aspnet-core/interactive)**
>
> This tutorial demonstrates how to add user login to an ASP.NET Core application.

But I feel that the /callback is not handled by the Auth0 SDK.

I probably miss something.  
I’ve created a new project with the visual studio template “[ASP.NET](http://ASP.NET) Core Web App (Model View Controller)” on the “Additional information” I’ve set :  
“Framework” =“.NET 6.0 (Long Term Support)  
“Authentication Type” = “None”  
Check “Configure for HTTPS”  
Uncheck “Enable Docker”  
Check “Do not use top-level statments”  
the code in my program.cs :  
public static void Main(string args)  
{  
var builder = WebApplication.CreateBuilder(args);  
builder.Services.AddAuth0WebAppAuthentication(options =\> {  
options.Domain = builder.Configuration[“Auth0:Domain”];  
options.ClientId = builder.Configuration[“Auth0:ClientId”];  
});  
builder.Services.AddControllersWithViews();  
var app = builder.Build();  
if (!app.Environment.IsDevelopment())  
{  
app.UseExceptionHandler(”/Home/Error");  
app.UseHsts();  
}  
app.UseHttpsRedirection();  
app.UseStaticFiles();  
app.UseRouting();  
app.UseAuthorization();  
app.MapControllerRoute(name: “default”,pattern: “{controller=Home}/{action=Index}/{id?}”);  
app.Run();  
}

I’m using the nuget package "Auth0.AspNetCore.Authentication 1.0.4 "

the account controller and the views are copy pasted from [GitHub - auth0-samples/auth0-aspnetcore-mvc-samples: Auth0 Integration Samples for ASP.NET Core MVC Web Applications](https://github.com/auth0-samples/auth0-aspnetcore-mvc-samples/) ( with namespage changed)

Can you help me ?

Thank you  
Geoffroy

---

<div class="post-metadata">

**Author:** ![SaqibHussain](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/saqibhussain/32/42924_2.png) [@SaqibHussain](https://community.auth0.com/u/SaqibHussain)\
**Post date:** [December 14, 2022, 11:38pm UTC](https://community.auth0.com/t/mvc-core-6-0-trying-to-get-the-example-work/96452/2 "2022-12-14T23:38:49Z")

</div>

Hi @gperrier

Welcome to the Auth0 Community.

Is there any specific issue/error you have in running the sample? I tested this out by downloading the sample from here [https://auth0.com/docs/quickstart/webapp/aspnet-core](https://auth0.com/docs/quickstart/webapp/aspnet-core) and I was able to get this to work with .NET 6.0

My csproj looks like this:

```auto
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Auth0.AspNetCore.Authentication" Version="1.0.3" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
  </ItemGroup>
</Project>

```

Warm regards.

---

<div class="post-metadata">

**Author:** ![gperrier](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gperrier/32/33195_2.png) [@gperrier](https://community.auth0.com/u/gperrier)\
**Post date:** [December 15, 2022, 8:37am UTC](https://community.auth0.com/t/mvc-core-6-0-trying-to-get-the-example-work/96452/3 "2022-12-15T08:37:32Z")

</div>

Hi [SaqibHussain](https://community.auth0.com/u/SaqibHussain),  
Thank you for the feedback  
The reference was missing in my project , but it still not work.

![image](https://global.discourse-cdn.com/auth0/original/3X/4/d/4dda955feb01700d60af41c21979b6b735d93909.png)  
I’m login well then the redirection is done with the token the cookie is also set but the App don’t handle it

 ![image](https://global.discourse-cdn.com/auth0/original/3X/4/b/4bb23eb0ff34f486b68a0b74eab85d1d5f29fcfe.png)  
I’m goging to clone the project from github. But I’ll need to integrate it into an existing project , So I’ve to get it Work from scratch.

Thank you

---

<div class="post-metadata">

**Author:** ![gperrier](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gperrier/32/33195_2.png) [@gperrier](https://community.auth0.com/u/gperrier)\
**Post date:** [December 15, 2022, 9:30am UTC](https://community.auth0.com/t/mvc-core-6-0-trying-to-get-the-example-work/96452/4 "2022-12-15T09:30:39Z")

</div>

Ok I’ve found what was missing :  
this block

app.UseEndpoints(endpoints =\>  
{  
endpoints.MapDefaultControllerRoute();  
});

after  
app.UseAuthentication();  
app.UseAuthorization();

Problem Solved  
Thank you

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 15, 2022, 10:30am UTC](https://community.auth0.com/t/mvc-core-6-0-trying-to-get-the-example-work/96452/5 "2022-12-15T10:30:42Z")

</div>

No worries! We’ve all been there! Thanks for sharing it with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 21, 2022, 6:14pm UTC](https://community.auth0.com/t/mvc-core-6-0-trying-to-get-the-example-work/96452/6 "2022-12-21T18:14:02Z")

</div>


