ASP.NET 2.0 - FAQ

· Why is there no DataGrid control on the Toolbox?

The DataGrid control has been superseded by the GridView control, which can do everything the DataGrid control does and more. The GridView control features automatic data binding; auto-generation of buttons for selecting, editing, and deleting; automatic sorting; and automatic paging. There is full backward compatibility for the DataGrid control, and pages that use the DataGrid will continue to work as they did in version 1.0 of ASP.NET.

· Can I still use the DataList and Repeater controls?

Absolutely. You can use them the way you always have. But note that the controls have been enhanced to be able to interact with data source controls and to use automatic data binding. For example, you can bind a DataList or Repeater control to a SqlDataSource control instead of writing ADO.NET code to access the database.

· What's the difference between login controls and Forms authentication?

Login controls are an easy way to implement Forms authentication without having to write any code. For example, the Login control performs the same functions you would normally perform when using the FormsAuthentication class — prompt for user credentials, validate them, and issue the authentication ticket — but with all the functionality wrapped in a control that you can just drag from the Toolbox in Visual Studio. Under the covers, the login control uses the FormsAuthentication class (for example, to issue the ticked) and ASP.NET membership (to validate the credentials). Naturally, you can still use Forms authentication yourself, and applications you have that currently use it will continue to run.

Configuring ASP.NET 2.0

· How is ASP.NET configuration data formatted?

ASP.NET configuration data is encoded in XML and stored as plaintext files. You can access these files programmatically by using administration tools or by using a text editor

· Where are the ASP.NET configuration files stored?

System-wide configuration settings and some ASP.NET schema settings are stored in a file named Machine.config, which is located in the %SystemRoot%\Microsoft .NET\Framework\versionNumber\CONFIG directory. This directory also contains other default settings for ASP.NET Web applications in a file that is referred to as the root Web.config file. ASP.NET configuration files for individual Web sites and applications, which are also named Web.config files, can be stored in any Web site root directory, application root directory, application subdirectory, or all of these.

· How are the ASP.NET configuration files related to the Internet Information Services (IIS) configuration file (the IIS metabase)?

In IIS versions 6.0 and earlier, the ASP.NET configuration system redirects any IIS-specific settings that it controls. The ASP.NET configuration system then configures IIS for you by automatically editing the IIS metabase. For information about the IIS metabase.

· I used the ASP.NET configuration system to restrict access to my ASP.NET application, but anonymous users can still view some of my files. Why is that?

The features of the ASP.NET configuration system only apply to ASP.NET resources. For example, Forms Authentication only restricts access to ASP.NET files, not to static files or ASP (classic) files unless those resources are mapped to ASP.NET file name extensions. Use the configuration features of IIS to configure non-ASP.NET resources.

· Since there can be multiple ASP.NET configuration files on one computer, how does ASP.NET configuration handle inheritance?

ASP.NET integrates the settings in configuration files (the Machine.config and Web.config files) into a single inheritance hierarchy. With a few exceptions, you can place a Web.config file wherever you need to override the configuration settings that are inherited from a configuration file located at a higher level in the hierarchy.

· How does ASP.NET consolidate the settings in all of the configuration files?

At run time, ASP.NET reads the settings in the Machine.config file and all of the Web.config files and then assembles a cache of the settings for each valid URL in each application on the server.

· What happens when a configuration setting changes during run time?

ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.

· Can I lock a configuration setting so that a Web.config file that appears lower in the hierarchy cannot override it?

Yes. By setting the location element's Override attribute to false, you can lock a specific setting so that it does not inherit settings from below.

· Can I configure specific folders directly?

Yes. By using the location element in a configuration file that is located higher in the configuration hierarchy, you can configure the attributes of individual resources, such as the application directories under a Web site or application subdirectories. This is useful in hosting environments for specifying configuration settings in a machine-level configuration file that apply to individual Web sites.

· How can I get programmatic access to ASP.NET configuration settings?

You can read, create, or modify configuration settings from within an ASP.NET application by using the ASP.NET management API. You can develop your own applications including Web applications, console applications, and scripts that use the management API.

· How can I get programmatic access to IIS configuration settings?

You can use ADSI, WMI, or COM interfaces to configure IIS programmatically.

· How are ASP.NET configuration files secured against unauthorized access?

ASP.NET configures IIS to deny access to any user that requests access to the Machine.config or Web.config files.

· What are the limitations when configuring ASP.NET by using the ASP.NET MMC snap-in?

The ASP.NET MMC snap-in allows you to set ASP.NET configuration at all levels, but on the local computer only.

· Can I configure ASP.NET Web sites and applications remotely?

Yes. You can use the Web Site Administration Tool to configure remote Web sites and applications by using a Web browser.

· Can I configure ASP.NET by directly editing the Machine.config and Web.config files?

Yes. You can use any text editor or XML editor to edit the ASP.NET configuration files directly. However, consider using one of the tools mentioned in the previous questions to edit ASP.NET configuration because those tools often ensure XML validation.

· Can I configure ASP.NET by directly editing the IIS metabase file?

The IIS 6.0 metabase is stored in an XML-formatted file called Metabase.xml. You can configure IIS to allow the metabase to be edited directly, but not all of the ASP.NET configuration settings are available in the IIS metabase. It is best to configure ASP.NET features by using the ASP.NET configuration system.

· What tools can I use to edit the IIS metabase?

You can use the IIS Manager snap-in for the MMC. For information about common administrative tasks for ASP.NET developers.

No comments: