Enables Web application track LastVisit of anonymous users in variable of type DateTime - ASP.NET Security

Q.  Which of the following Web.config files correctly enables the Web application to track the LastVisit of anonymous users in a variable of type DateTime?

- Published on 27 Jul 15

a.
<anonymousIdentification enabled="true"/>
<profile>
<properties>
<add name="LastVisit" type="System.DateTime" allowAnonymous="true" />
</properties>
</profile>
b.
<anonymousIdentification enabled="true"/>
<profile>
<properties>
<add name=" LastVisit " allowAnonymous="true" />
</properties>
</profile>
c.
<anonymousIdentification enabled="true" />
<profile>
< properties>
< add name=" LastVisit " type="System. DateTime " />
</properties>
</profile>
d.
<profile>
<properties>
<add name="LastVisit" type="System. DateTime "/>
</properties>
</profile>

ANSWER:
<anonymousIdentification enabled="true"/>
<profile>
<properties>
<add name="LastVisit" type="System.DateTime" allowAnonymous="true" />
</properties>
</profile>
 

    Discussion

  • Digvijay   -Posted on 16 Sep 15
    By default, a user profile and its properties are enabled only for authenticated users. If you want that anonymous users can also use features of a user profile. To do this set attribute allowAnonymous to true and must add the element to your web.config
    < anonymousIdentification enabled="true"/>
    < profile>
    < properties>
    < add name="LastVisit" type="System.DateTime" allowAnonymous="true" />
    < / properties>
    < / profile>
    In the above scenario, anonymous profiles are enabled and ASP.NET creates a unique identification for each user the first time visits your site. This value is stored and tracked by a browser cookie.

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.)