Issue with Startup Page Execution in Visual Studio 2019 MVC/WebAPI Project

15 Views Asked by At

I'm currently working on implementing a functionality in my application that allows users to edit MS Office documents. To set up the foundation for this feature, I've chosen Visual Studio 2019 and created an empty project with MVC and WebAPI.

Here's a snippet of my code:

global page:

public class Global : HttpApplication
{
    void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup
        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(WebApiConfig.Register);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
    }
}

startup Page:

using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OpenIdConnect;
using Owin;
using System.Configuration;
using System.Threading.Tasks;

[assembly: OwinStartup(typeof(MS_office_Read_WriteV3.App_Start.Startup))]

namespace MS_office_Read_WriteV3.App_Start
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = "Cookies",
            });

            app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
            {
                ClientId = ConfigurationManager.AppSettings["ida:ClientId"],
                Authority = ConfigurationManager.AppSettings["ida:Authority"],
                RedirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"],
                ResponseType = "id_token",
                Scope = "openid profile",
                SignInAsAuthenticationType = "Cookies",

                Notifications = new OpenIdConnectAuthenticationNotifications
                {
                    SecurityTokenValidated = context =>
                    {
                        // Add custom claims or logic after successful token validation
                        return Task.CompletedTask;
                    }
                }
            });
        }
    }
}

The challenge I'm facing is that my startup page is not being executed when I run the project. I've ensured that the necessary configurations are in place, but it seems like there might be something I'm overlooking.

Could someone kindly guide me on what might be causing this issue or if there are any specific configurations that need attention? Your assistance would be greatly appreciated.

Thank you in advance!

0

There are 0 best solutions below