Sunday, 26 October 2014

asp.net interview questions part- 3

RequiredField Validator Control,Range Validator Control, RegularExpression Validator Control,Custom Validator Control and Validation Summary Control are provided by ASP.NET.
AutoPostBack is built into the form-based server controls, and when enabled, automatically posts the page back to the server whenever the value of the control in question is changed.
Using the Built-In Paging Controls
To use default paging, you set properties to enable paging, set the page size, and specify the style of the paging controls. Paging controls are LinkButton controls. You can choose from these types: Next and previous buttons. The button captions can be any text you want. Page numbers, which allow users to jump to a specific page. You can specify how many numbers are displayed; if there are more pages, an ellipsis ( … ) is displayed next to the numbers. You must also create an event-handling method that responds when users click a navigation control.
To use the built-in paging controlsSet the control’s AllowPaging property to true. Set the PageSize property to the number of items to display per page.
To set the appearance of the paging buttons, include a element into the page as a child of the DataGrid control. For syntax, see DataGrid Control Syntax. Create a handler for the grid’s PageIndexChanged event to respond to a paging request. The DataGridPageChangedEventsArgs enumeration contains the NewPageIndex property, which is the page the user would like to browse to. Set the grid’s CurrentPageIndex property to e.NewPageIndex, then rebind the data.
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 classprompt for user credentials, validate them, and issue the authentication ticketbut 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 authentication ticket) and ASP.NET membership (to validate the user credentials). Naturally, you can still use Forms authentication yourself, and applications you have that currently use it will continue to run.
ASP.NET introduces new functionality that allows you to write debug statements, directly in your code, without having to remove them from your application when it is deployed to production servers. Called tracing, this feature allows you to write variables or structures in a page, assert whether a condition is met, or simply trace through the execution path of your page or application.
Instead of enabling tracing for individual pages, you can enable it for your entire application. In that case, every page in your application displays trace information. Application tracing is useful when you are developing an application because you can easily enable it and disable it without editing individual pages. When your application is complete, you can turn off tracing for all pages at once.When you enable tracing for an application, ASP.NET collects trace information for each request to the application, up to the maximum number of requests you specify. The default number of requests is 10. You can view trace information with the trace viewer.By default, when the trace viewer reaches its request limit, the application stops storing trace requests. However, you can configure application-level tracing to always store the most recent tracing data, discarding the oldest data when the maximum number of requests is reached.To Enable Tracing for an application
1.Open your Web site’s Web.config file. If no Web.config file exists, create a new file in the root folder and copy the following into it:
2.Add a trace element as a child of the system.web element.
3.In the trace element, set the enabled attribute to true.
4.If you want trace information to appear at the end of the page that it is associated with, set the trace element’s pageOutput attribute to true. If you want tracing information to be displayed only in the trace viewer, set the pageOutput attribute to false.For example, the following application trace configuration collects trace information for up to 40 requests and allows browsers on computers other than the server of origin to display the trace viewer. Trace information is not displayed in individual pages.
At its core, the ASP.NET execution engine compiles the page into a class, which derives from the code behind class (which in turn derives directly or indirectly from the Page class). Then it injects the newly created class into the execution environment, instantiates it, and executes it. ASP.NET, on the other hand, can accept code in any language that is compatible with the .NET framework, because it’s compiled down natively just like other code.
You can deploy an ASP.NET Web application using any one of the following three deployment options.1.XCOPY Deployment
2.Using the Copy Project option in VS .NET
3.Deployment using VS.NET installer
ASP.NET Configuration
The ASP.NET configuration system features an extensible infrastructure that enables you to define configuration settings at the time your ASP.NET applications are first deployed so that you can add or revise configuration settings at any time with minimal impact on operational Web applications and servers.
The ASP.NET configuration system provides the following benefits:
* Configuration information is stored in XML-based text files. You can use any standard text editor or XML parser to create and edit ASP.NET configuration files.
* Multiple configuration files, all named Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. Configuration files in child directories can supply configuration information in addition to that inherited from parent directories, and the child directory configuration settings can override or modify settings defined in parent directories. The root configuration file named systemrootMicrosoft.NETFrameworkversionNumberCONFIGMachine.config provides ASP.NET configuration settings for the entire Web server.
* At run time, ASP.NET uses the configuration information provided by the Web.config files in a hierarchical virtual directory structure to compute a collection of configuration settings for each unique URL resource. The resulting configuration settings are then cached for all subsequent requests to a resource. Note that inheritance is defined by the incoming request path (the URL), not the file system paths to the resources on disk (the physical paths).
* ASP.NET detects changes to configuration files and automatically applies new configuration settings to Web resources affected by the changes. The server does not have to be rebooted for the changes to take effect. Hierarchical configuration settings are automatically recalculated and recached whenever a configuration file in the hierarchy is changed. The
section is an exception.
* The ASP.NET configuration system is extensible. You can define new configuration parameters and write configuration section handlers to process them.

* ASP.NET help protect configuration files from outside access by configuring Internet Information Services (IIS) to prevent direct browser access to configuration files. HTTP access error 403 (forbidden) is returned to any browser attempting to request a configuration file directly.



Read All Questions :-asp.net interview questions part-(1 to 8)
You have gain more knowledge

Visit Daily 

 best of luck !

No comments:

Post a Comment