How can I have ASP.NET automatically redirect non-logged in Forms users to the login page?

前端 未结 4 1791
谎友^
谎友^ 2021-02-07 09:35

I have an ASP.NET website.

I want users who are not logged in to be automatically (re)directed to the login page, for example,

~/Account/Login.aspx
         


        
4条回答
  •  Happy的楠姐
    2021-02-07 09:54

    I know it's many years later, but if anyone finds themself here you may be missing this bit in the webconfig. Within the tag you need to add this:

    
    
      
        
      
    
    

    This tells the site that SecurePage.aspx requries the user to be logged in. This is how I've been doing it for a few years now

提交回复
热议问题