Иллюстрированный самоучитель по Visual Basic .NET

Файл Web.config

В ранних версиях Windows конфигурационные данные хранились в ini-файлах, на смену которым пришел глобальный реестр. В ASP.NET приложения фактически возвращаются к временам текстовых ini-файлов – конфигурационные данные хранятся в текстовом файле Web.config, находящемся в каталоге приложения. Этот файл определяет условия выполнения приложений ASP.NET – такие как параметры отладки и системы безопасности. Конфигурационные файлы имеют довольно сложную структуру. Ниже приведено содержимое файла Web.config для предыдущего примера:

1 <?xml version-"1.0" encoding="utf-8"?>
2 <configuration>
3 <system.web>
4 <!--DYNAMIC DEBUG COMPILATION
5 Set compilation debug="true" to insert debugging symbols (.pdb
6 information)into the compiled page.Because this creates a larger file
7 that executes more slowly,you should set this value to true only when
8 debugging.and to false at all other times.For more information,refer
9 to the documentation about debugging ASP.NET files.
10 ›
11 compilation defaultl_anguage="vb" debug="true"/>
12 <!--CUSTOM ERROR MESSAGES
13 Set customErrors mode="0n" or "RemoteOnly" to enable custom error
14 messages. "Off"to disable.Add <error> tags for each of the errors
15 you want to handle.
16 ›
17 <customErrors mode="RemoteOnly"/>
18 <!--AUTHENTICATION
19 This section sets the authentication policies of the application.
20 Possible modes are "Windows". "Forms". "Passport" and "None"
21 ›
22 <authentication mode="windows"/>
23 <!--AUTHORIZATION
24 This section sets the authorization policies of the application.You can
25 allow or deny access to application resources by user or role.
26 Wildcards: "*" mean everyone, "?" means anonymous (unauthenticated)
27 users.
28 ›
29 <authorization>
30 <allow users- "*" /><! – Allow all users – >
31 <!--<allow users="[comma separated list of users]"
32 roles="[comma separated list of roles]"/>
33 <deny users="[comma separated list of users ]"
34 roles="[comma separated list of roles]"/>
35 ›
36 </authorization>
37 <!--APPLICATION-LEVEL TRACE LOGGING
38 Application"level tracing enables trace log output for every page within
39 an application.Set trace enabled= "true"to enable application trace
40 logging.If pageOutput – "true",the trace information will be displayed at
41 the bottom of each page.Otherwise,you can view the application trace
42 log by browsing the "trace.axd"page from your Web application root.
43 ›
44 <trace enabled- "false" requestLimit = "10"
45 pageOutput = "false" traceMode = "SortByTime"
46 localOnly – "true" />
47 (--SESSION STATE SETTINGS
48 By default ASP.NET uses cookies to identify which requests belong to a
49 particular session.If cookies are not available.a session can be
50 tracked by adding a session identifier session.To disable cookies.set
51 sessionState cookieless = "true"'
52 ›
53 <sessionState
54 mode="InProc"
55 stateConnectionString – "tcpip=127.0.0.1:42424"
56 sqlConnectionSthng = "data source=127.0.0.1:user id=sa:password="
57 cookieless="false"
58 timeout="20"
59 />
60 <!--PREVENT SOURCE CODE DOWNLOAD
61 This section sets the types of files that will not be downloaded.As
62 well as entering a httphandler for a file type.you must also *
63 associate that file type with the xspisapi.dll in the App Mappings
64 property of the Web site.or the file can be downloaded.lt is
65 recommended that you use this section to prevent your sources from
66 being downloaded.
67 ›
68 <httpHandlers>
69 <add verb= "*" path= "*.vb"
70 type= "System.Web.HttpNotFoundHandler.System.Web"/>
71 <add verb="*" path = "*.cs"
72 type= "System.Web.HttpNotFoundHandler.System.Web"/>
73 <add verb="*" path="*.vbproj"
74 type= "System.Web.HttpNotFoundHandler.System.Web"/>
75 <add verb="*" path="*.csproj"
76 type= "System.Web.HttpNotFoundHandler.System.Web"/>
77 <add verb="*" path-"*.webinfo"
78 type= "System.Web.HttpNotFoundHandler.System.Web"/>
79 </httpHandlers>
80 <!--GLOBALIZATION
81 This section sets the globalization settings of the application.
82 ›
83 <globalization requestEncoding= "utf-8" responseEncoding="utf-8"/>
84 </system.web>
85 </configuration>
Если Вы заметили ошибку, выделите, пожалуйста, необходимый текст и нажмите CTRL + Enter, чтобы сообщить об этом редактору.