The note of learning ASP. NET [3] [about ASP. NET configuration file web. config]

Source: Internet
Author: User

Wow .. On the first day of work after the May Day holiday, I started to take a nap at AM ~ It's a little mental. Let's take a look at things and write diaries, and today's work daily: d

When I thought about where to start, I first learned about ASP. the entire running process of the. NET application, and the lifecycle of the page. NET application has a general understanding of the content, and then installed. net Framework 3.5, vs2008, and sqlserver2008 have been released on the Internet over the past two days. net Framework 4.0, but I want to learn about vs2008 and. net 3.5 is no longer difficult to learn new things. ASP. NET has two configuration files: machine. config and web. config. The machine. config file is generally stored in the C:/Windows/Microsoft. NET/framework/v2.0.50727/config directory, while web. config is generally stored in the root directory of the website. From the location where the two configuration files are stored, we can see that machine. config applies to the entire application server, while web. the scope of config is limited to its specific web application (website ). Machine. config can be used for all site applications running on this application server. The configuration in Web. config can overwrite some existing default settings in machine. config. Here we often use web. config. When we use vs2008 to create a website, Such a configuration file will be generated by default (it is said that vs2005 will not generate such a file and must be manually generated ), the configuration file involves a lot of content that is running on our website. It is impossible to figure out all the content at a time. This is the case every time we learn it. First, we need to figure out what can be used, we will study other configurations when they are used. The default generated Wen. config is an XML file encoded with UTF-8, which automatically generates many configuration nodes, <connectionstrings/> <Authentication mode = "Windows"/> <Connectionstrings>
<! -- Because in machine. config already has the definition of "name" localsqlserver, so we need to clear it first. Of course we can use another name, but some default components will be defined as using the database connection string by default, for example, the membership that will be used later is used to configure the User Authentication Component -->
<Remove name = "localsqlserver"/>
<! -- Data source is the address of the database server, and initial catalog is the name of the database -->
<Add name = "localsqlserver" connectionstring = "Data Source = localhost; initial catalog = asplearn; user id = sa; Password = ***" providername = "system. data. sqlclient "/>
</Connectionstrings>
<Authentication mode = "Windows"/> this node is used to specify the User Authentication mode. mode has four options: None, windows, forms, and passport. This node can be configured with the ASP. NET built-in user management function. In simple words, the user management function is a function that allows users to log on to the website and set the content that users can access .. NET provides the membership class for us to conveniently access the login user information and provide some methods to operate on the user. Among the four options, Windows uses the user's login information of the Windows operating system for verification. forms is the most commonly used method for Web login authentication, passport is a technology available everywhere for one login. Simply put, as long as you log on once, you can access many sites that are originally required to log on as login users. All sites that require passport must use the SDK provided by passport for secondary development. The mode attribute is set to Windows by default, and usually needs to be changed to forms. For more information about user management, you can download the ASP. NET 2.0 Quick Start (6): ASP. NET 2.0 Member Management Course on msdn webcast. <Httphandlers/>
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.