Prevent unauthenticated users from accessing the application - ASP.NET Security

Q.  You are creating an ASP.NET application for company CareerRide. You use form based authentication to validate users. You need to prevent unauthenticated users from accessing the application. What should you do?

- Published on 27 Jul 15

a. In the authorization section of the Web.config file, set the users attribute of the deny element to “?”
b. Set In the authorization section of the Web.config file, set the users attribute of the deny element to “*”
c. In the authorization section of the Machine.config file, set the users attribute to the allow element to “?”.
d. None of the above.

ANSWER: In the authorization section of the Web.config file, set the users attribute of the deny element to “?”
 

    Discussion

  • Digvijay   -Posted on 21 Sep 15
    In the authorization section of the Web.config file, write the given below code
    < configuration>
    < system.web>
    < authorization>
    < deny users=”?”/>
    < /authorization>
    < /system.web>
    < /configuration>
    If you add the file, then unauthenticated users cannot access any pages. The configuration file denies access to anonymous users. The ? symbol represents anonymous unauthenticated users. You can also provide a particular username, or comma-delimited list of usernames, to the deny element.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)