1

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/
1
  • please define your application folder path in the <base href="/MyApplicationFolder"> tag in index.html Commented Oct 16, 2021 at 12:19

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

"URL rewrite h to /Home in IIS." did the trick. Thank You

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.