|
|
| What is the use of @OutputCache directive in ASP.NET? |
It is basically used for caching. |
| How can we create custom controls in ASP.NET? |
User controls are created using .ASCX in ASP.NET. After .ASCX file is created you need two things in order that the ASCX can be used in project :
Register the ASCX control in page using the <%@ Register directive. Example
<%@ Register tagprefix="Accounting" Tagname="footer" Src="Footer.ascx" %>
Now to use the above accounting footer in page you can use the below directive.
<Accounting:footer runat="server" />
|
| How many types of validation controls are provided by ASP.NET? |
|
|
There are six main types of validation controls :
RequiredFieldValidator
It checks whether the control have any value. It is used when you want the control should not be empty.
RangeValidator
It checks if the value in validated control is in that specific range. Example TxtCustomerCode should not be more than eight length.
CompareValidator
It checks that the value in controls should match some specific value. Example Textbox TxtPie should be equal to 3.14
RegularExpressionValidator
When we want the control value should match with a specific regular expression.
CustomValidator
It is used to define UserDefined validation.
ValidationSummary
It displays summary of all current validation errors.
|
|
| Can you explain what is "AutoPostBack" feature in ASP.NET? |
If we want the control to automatically postback in case of any event, we will need to check this attribute as true. Example on a ComboBox change we need to send the event immediately to the server side then set the "AutoPostBack" attribute to true.
|
| How can you enable automatic paging in DataGrid? |
Following are the points to be done in order to enable paging in DataGrid :
Set the "AllowPaging" to true.
In PageIndexChanged event set the current pageindex clicked.
|
| What is the use of "GLOBAL.ASAX" file? |
It allows to executing ASP.NET application level events and setting application-level variables.
|
| What is the difference between "Web.config" and "Machine.config"? |
"Web.config" files apply settings to each web application, while "Machine.config" file apply settings to all ASP.NET applications.
|
| What is a SESSION and APPLICATION object? |
Session object store information between HTTP requests for a particular user, while application object are global across users.
|
| What is the difference between Server.Transfer and response.Redirect? |
|
Following are the major differences between them :
Response.Redirect sends message to the browser saying it to move to some different page, while server.transfer does not send any message to the browser but rather redirects the user directly from the server itself. so in server.transfer there is no round trip while response.redirect has a round trip and hence puts a load on server.
Using Server.Transfer you can not redirect to a different from the server itself. Example if your server is www.yahoo.com you can not use server.transfer to move to www.microsoft.com but yes you can move to www.yahoo.com/travels, i.e. within websites. This cross server redirect is possible only using Request.redirect.
With server.transfer you can preserve your information. It has a parameter called as "preserverForm". So the existing query string etc. will be able in the calling page.
If you are navigating within the same website use "server.transfer" or else go for "response.redirect()"
|
|
|
| What is the difference between Authentication and authorization? |
Authentication is verifying the identity of a user and authorization is process where we check does this identity have access rights to the system. In short we can say the following, authentication is the process of obtaining some sort of credentials from the users and using those credentials to verify the users identity. Authorization is the process of allowing an authenticated user access to resources. Authentication always proceed to Authorization; even if your application lets anonymous users connect and use the application, it still authenticates them as being anonymous.
|
|
|
|
|