Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASP.Net MVC: How unauthorize access redirect user to login page

ASP.Net MVC: How unauthorize access redirect user to login page

Scheduled Pinned Locked Moved ASP.NET
asp-netdatabasetutorialcsharparchitecture
4 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mou_kol
    wrote on last edited by
    #1

    suppose i am developing a site with ASP.Net MVC core. i have created a empty project where i add two controller. one is Home and login controller. Home controller's index action is not protected by Authorized attribute but Home controller's product action is protected. when user try to access product action then user should be redirected to login page if not signed in. so tell me how to setup project in classic mvc or mvc core where i will mention that user should be redirected to login page if user is not signed in. i will not use identity rather i will check user credentials from db using ado.net. please guide me step wise that what i need to follow. Thanks

    Richard DeemingR 1 Reply Last reply
    0
    • M Mou_kol

      suppose i am developing a site with ASP.Net MVC core. i have created a empty project where i add two controller. one is Home and login controller. Home controller's index action is not protected by Authorized attribute but Home controller's product action is protected. when user try to access product action then user should be redirected to login page if not signed in. so tell me how to setup project in classic mvc or mvc core where i will mention that user should be redirected to login page if user is not signed in. i will not use identity rather i will check user credentials from db using ado.net. please guide me step wise that what i need to follow. Thanks

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Introduction to authorization in ASP.NET Core | Microsoft Docs[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      M 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Introduction to authorization in ASP.NET Core | Microsoft Docs[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        M Offline
        M Offline
        Mou_kol
        wrote on last edited by
        #3

        Sir, my question was bit different. i am trying to know how asp.net mvc engine understand now user need to redirect to login page? if login controller name would be different then how asp.net mvc understand it ? where this binding done in default project when we create a default project from IDE? i believe there must be a place where we mention that login page should come if user is not signed in when access any protected resource. please share knowledge if you know. thanks

        Richard DeemingR 1 Reply Last reply
        0
        • M Mou_kol

          Sir, my question was bit different. i am trying to know how asp.net mvc engine understand now user need to redirect to login page? if login controller name would be different then how asp.net mvc understand it ? where this binding done in default project when we create a default project from IDE? i believe there must be a place where we mention that login page should come if user is not signed in when access any protected resource. please share knowledge if you know. thanks

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          Overview of ASP.NET Core Authentication | Microsoft Docs[^]


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups