DotNetBeginner
DotNetBeginner

Reputation: 439

routing in angular 12

I have used angular 12 in VSCode and Web Api 2 to develop my application.

my routing looks like this

const routes: Routes = [
    { path: '', component: HomeComponent, canActivate: [AuthGuard] },
    { path: 'home', component: HomeComponent, canActivate: [AuthGuard] },
    { path: 'login', component: LoginComponent },
     .......// other routes in the application
];

 @NgModule({
     imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })],
     exports: [RouterModule]
 })
 export class AppRoutingModule { }

I have deployed my application in Dev server. The url looks something like this

https://myDomain/MyApplicationFolder/Login

Login page is rendered perfectly. All the routing works fine. my only concern is

if I type

https://myDomain/MyApplicationFolder/  I get forbidden error.

enter image description here

Is there anyways that i get redirected to

https://myDomain/MyApplicationFolder/home 

if anyone types

https://myDomain/MyApplicationFolder/

Upvotes: 1

Views: 416

Answers (1)

New Rhino
New Rhino

Reputation: 339

This seems more of a problem with IIS, you should look into how you configured you server.

Is anonymous authentication on?

If you've configured an URL rewrite for this you could possibly rewrite the root path to /Home in IIS.

Upvotes: 2

Related Questions