asp.net 2 sexual configuration (profile) __.net

Source: Internet
Author: User
Tags datetime stack trace connectionstrings
asp.net 2 sexual configuration (profile)

Store configuration information for each user
Strong type long-term save support for anonymous users
Definition configuration (Profile)

<?xml version= "1.0"?>

<configuration xmlns= "http://schemas.microsoft.com/.NetConfiguration/v2.0" >
<appSettings/>
<connectionStrings>
<add name= "Northwind" connectionstring= "server=localhost;integrated security=true;database=northwind" Providername= "System.Data.SqlClient"/>
</connectionStrings>
<system.web>

<anonymousidentification enabled= "true"/>
<profile>//Definition configuration (Profile)
<properties>
<add name= "Theme" allowanonymous= "true"/>
<add name= "lastvisit" type= "System.DateTime" allowanonymous= "true"/>
</properties>
</profile>
<!--
<webParts>//Definition configuration (WebParts)
<personalization defaultprovider= "Aspnetsqlpersonalizationprovider"/>
</webParts>
-->
<!--
Set compilation debug= "true" to insert debugging symbols into the compiled page.
Because this affects performance, the set this value to true only during development.
-->
<compilation debug= "true" >
<expressionBuilders>
<add expressionprefix= "Version" type= "Versionexpressionbuilder"/>
</expressionBuilders>
</compilation>
<!--
The <authentication> section enables configuration of the security authentication
Mode used by ASP.net to identify a incoming user.
-->
<authentication mode= "Windows"/>
<!--
The <customErrors> section enables configuration of what to did if/when an unhandled
Error occurs during the execution of a request. Specifically, it enables developers
To configure HTML error pages to is displayed in place of a error stack trace.
-->
<customerrors mode= "RemoteOnly" defaultredirect= "genericerrorpage.htm" >
<!--
<error statuscode= "403" redirect= "noaccess.htm"/>
<error statuscode= "404" redirect= "filenotfound.htm"/>
-->
</customErrors>
</system.web>
</configuration>


Use configuration (Profile)
Increment the current user ' s post cout
Profile.posts = profile.posts+1;
Update the current user "s Last Post Date
Profile.lastpost = DateTime.Now;

Personalization data will be stored in the database

Introduced
Microsoft asp.net 2.0 supports a new object called Profile, which automatically stores user information between access to multiple Web applications. A user profile can store various types of information that can be either simple string and integer types or complex custom types. For example, you can store the user's last name, shopping basket, user attributes, or site usage statistics.
In this article, you will learn how to define user profile in an application. We will also show you how to configure profile with different provider. Finally, you will learn how to manage and generate user profile reports.

User Profiles commanding
The profile object is very similar to the session object, but is better used. The similarity to the session is that profile is relative to a particular user, that is, each Web application user has its own profile object. Unlike the session, the profile object is a persistent object. If you give

Related Article

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.