I have LoggincController.CS ,Login.html, Program.cs ,purchaseorderview.html i need to…
- User
I have LoggincController.CS ,Login.html, Program.cs ,purchaseorderview.html i need to redirect first to login.html opage when it matches with appsettings.json Admin credentails it must show purchaseorderview.html if they try to access these page directly it should not be worked. So give me step by step I will give my current Program.cs
Assistant
I'll help you implement authentication and authorization to redirect to login first, validate against appsettings.json credentials, and protect the purchase order view.
Please share your current Program.cs file so I can see your existing setup and provide specific step-by-step instructions that work with your current configuration.
Once you share that, I'll guide you through:
- Setting up authentication middleware
- Configuring session management
- Modifying your LoginController to validate against appsettings.json
- Adding authorization attributes to protect routes
- Ensuring direct access to protected pages is blocked
- Setting up proper redirects
Go ahead and paste your Program.cs content.