Which code segment should you use?

You are working on an existing Web site. You need to secure the Web site by redirecting all users to the logon page, Login.aspx. After logging on, users must be sent back to the page that they originally requested. Which code segment should you use?

You are working on an existing Web site. You need to secure the Web site by redirecting all users to the logon page, Login.aspx. After logging on, users must be sent back to the page that they originally requested. Which code segment should you use?

A.
In the Web.config file: <authorization> <deny users="?" /> </authorization>
On each page in the Web site:
void Page_Load(Object sender, EventArgs E)
{
FormsAuthenticaiton.Initialize();
//Rest of the Page_Load code goes here
}

B.
On each page in the Web site:
void Page_Load(Object sender, EventArgs E)
{
FormsAuthentication.RedirectToLoginpage("login.aspx"); //Rest of teh Page_Load code goes here
}

C.
On each page in the Web site:
void Page_Load(Object sender, EventArgs E){
Response.Redirect("login.aspx");
//Rest of the Page_Load code goes here]

D.
In the Web.config file:
<authentication mode="Forms">
<forms name=".ASPXUSERDEMO" loginUrl="login.aspx" protection="All" timeout="60" />
</authentication>



Leave a Reply 0

Your email address will not be published. Required fields are marked *