Description of the safety of the Venus System (OA system, reservation system, leave system, etc.)

Source: Internet
Author: User

The Guiding star system is recommended to be installed in the intranet, therefore, the system uses a relatively simple authentication.

In fact, when the page is accessed, the system will determine whether the current cookie's UID is greater than 0, and if so, indicates that the user is logged in or is not logged in.

    public static int GetUserId        {  
Get { return (httpcontext.current.request.cookies["userinfo"] = = null)? -1:int. Parse (httpcontext.current.request.cookies["userinfo" ["userid"]); } }

Then, on the Master Master page, determine if the UserID is greater than 0:

if (Userhelper.getuserid > 0)            {               //already logged in            }            else            {                 Response.Redirect ("Login.aspx");            }

For the intranet, basically security can be satisfied, but for the users put on the public network, it is necessary to consider the attacker can easily forge cookies to bypass the authentication.

For users on the public network, please open the Web. config and add the following red configuration.

The system will be forced to use the authentication built into the ASP.

  <system.web>    <authorization>      <deny users= "?" />    </authorization>    </system.web>

-------------------------------------above---------------------------------------------------------------------------------- ------------------------

For users put on the public network, the above basically can give a good system to meet the security. However, you may want the system to automatically remember the user login name and password. In fact, in our login code,

   Httpcontext.current.response.cookies[formsauthentication.formscookiename]. Path = path;                Httpcontext.current.response.cookies[formsauthentication.formscookiename]. Expires = DateTime.Now.AddDays (7);

But you will find that when the <deny users= "?" is added to the/>, the system does not seem to remember the cookie, basically every visit or need to log in.

This is because ASP. NET will automatically generate a random computer key when the system is running.

You can force ASP. NET to use a unique key by using the following method.

Open IIS. Choose your app on the left. Then find the computer key on the right.

As you can see, the system randomly generates a computer key each time the application runs.

Click "Generate Key" on the right

Click Apply

At this point, the system automatically adds the Machiekey key to the Web. config. This way, you can remember your account by using form authentication.

Description of the safety of the Venus System (OA system, reservation system, leave system, etc.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.