Reputation: 3266
I have developed an SPA app using Aurelia in ASP.NET Core. Right now, I in my startup.cs file I have the following in my configure method:
app.UseIISPlatformHandler();
app.UseApplicationInsightsExceptionTelemetry();
app.UseStaticFiles();
app.UseFileServer(new FileServerOptions
{
EnableDefaultFiles = true,
EnableDirectoryBrowsing = false
});
From what I understand, this app.UseStaticFiles()
directs the app to look in the wwwroot folder for a default.html
or index.html
. I want to somehow do some business logic to check the users windows username and run it through our business logic to check/verify it. Is there a way in which I can just create a home controller and have that controller return the wwwroot/index.html file after it does the proper checking or maybe even accomplish this from within the startup.cs file? If so, can you elaborate on how.
Upvotes: 0
Views: 831
Reputation: 416
I think the best solution for that will be inserting you file in view folder. Then add to startup
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
In Index method put your business logic for checking for verify.
If you interested in nice solutution for autenticate user you can look at : https://docs.asp.net/en/latest/security/authentication/identity.html
Upvotes: 1