Question 124


5.1.2 Question

Multiple Choice

Forms authentication enables you to write code to validate user credentials. After it is complete, you can register the authentication cookies for use throughout the user’s visit by using which of the following?

  • A. FormsAuthentication.SetAuthCookie
  • B. FormsAuthenticationCookie = new FormsAuthenicationCookie();
  • C. FormsAuthentication.ClearAuthCookie
  • D. MembershipProvider.User =

Answer:

A
Explanation
A. Correct: FormsAuthentication.SetAuthCookie registers the authentication token in the cookie for use in future requests.
B. Incorrect: You have created a new FormsAuthenticationCookie, but it has no val­ues, so it would not be useful in future requests.
C. Incorrect: FormsAuthentication.ClearAuthCookie removes the authentication token.
D. Incorrect: MembershipProvider.User = does not maintain information between requests.