Quickest way to require authentication in asp.net webform?

前端 未结 4 355
不知归路
不知归路 2021-01-21 17:37

As of right now, I have the user register/log in and then if successful, redirect them to the homepage. However, this is extremely artificial as the user can simply type the ur

4条回答
  •  生来不讨喜
    2021-01-21 18:01

    Here is Walkthrough: Creating a Website with Membership and User Logon that you can use.

    As far as using cookies is concerned, they can be exploited. To be safe, its best not to put anything of value in them. If you have to, then you should secure them (another topic all together). In the scope of your question, know that ASP.NET encodes and hashes its authorization ticket so you are ok using the default cookie settings. More info on the Web.config form element attributes here.

    Forms Authentication is setup in the Web.config file. You can set the slidingExpiration attribute to log a user out if they haven't made a request with in the time set in the attribute.

提交回复
热议问题