Prepered .Net New
Prepered .Net New
Makes code easy to understand and debug by separating application logic from
HTML tags
32. Which method has been introduced in ASP.NET 4.0 to redirect a page permanently?
The RedirectPermanent() method added in ASP.NET 4.0 to redirect a page
permanently. The following code snippet is an example of
the RedirectPermanent() method:
RedirectPermanent("/path/Aboutus.aspx");
34. What is the difference between
the Response.Write() and Response.Output.Write() methods?
The Response.Write() method allows you to write the normal output; whereas,
theResponse.Output.Write() method allows you to write the formatted output.
35. What does the Orientation property do in a Menu control?
Orientation property of the Menu control sets the horizontal or vertical display of a menu
on a Web page. By default, the orientation is vertical.
36. Differentiate between client-side and server-side validations in Web pages.
Client-side validations take place at the client end with the help of JavaScript and
VBScript before the Web page is sent to the server. On the other hand, server-side
validations take place at the server end.
What is the default timeout for a Cookie?
The default time duration for a Cookie is 30 minutes.
What are the events that happen when a client requests an ASP.NET page from IIS
server?
The following events happen when a client requests an ASP.NET page from the IIS
server:
<authorization >
<deny users="username" />
</authorization>
What are the event handlers that can be included in the Global.asax file?
The Global.asax file contains some of the following important event handlers:
Application_Error
Application_Start
Application_End
Session_Start
Session_End
Page request - During this stage, ASP.NET makes sure the page either parsed or
compiled and a cached version of the page can be sent in response
Start - During this stage sets the Request and Response page properties and the
page check the page request is either a postback or a new request
Page Initialization - During this stage, the page initialize and the control's Unique
Id property are set
Load - During this stage, if the request is postback, the control properties are
loaded without loading the view state and control state otherwise loads the view
state
Postback event handling - During this stage, if the request is a postback, handles
the event
Rendering - During this stage, the page invokes the Render method to each
control for return the output
Unload - During this stage, when the page is completely rendered and sent to the
client, the page is unloaded.(Garbage Collection) (ex. File read, connection close,
and Called Finalize Method) (free unmanaged code)
What is State Management? How many ways are there to maintain a state in .NET?
State management is used to store information requests. The state management is used
to trace the information or data that affect the state of the applications.
There are two ways to maintain a state in .NET, Client-Based state management and
Server-Based state management.
The following techniques can be used to implement the Client-Based state management:
View State
Hidden Fields
Cookies
Query Strings
Control State
Application State
Session State
Profile Properties
ASP.NET manages the session state in the same process that processes the request and
does not create a cookie. It is known as a cookie less session. If cookies are not
available, a session is tracked by adding a session identifier to the URL. The cookie less
session is enabled using the following code snippet:<sessionState cookieless="true"
/>
What is a round trip?
The trip of a Web page from the client to the server and then back to the client is known
as a round trip.
What are the major built-in objects in ASP.NET?
The major built-in objects in ASP.NET are as follows:
Application
Request
Response
Server
Session
Context
Trace
There are various techniques in ASP.NET to authenticate a user. You can use one of the
following ways of authentication to select a built-in authentication provider:
RowCreated event fires when the html-controls for a row are created. For
example the controls you specify in templates, such as a text box or a
dropdownlist. Data binding has not yet taken place.
RowDataBound event fires when the data row is bound to the data of the
GridView. Can be used to do data manipulation based on the custom condition, or
do logical function based on the data for each GridViewRow or to alter the UI of
each row based on the condition.
RowCommand event fires when a button is clicked from inside the GridView
Row. Can be used to Select,Insert,Update, Delete, or to do custom operation
inside the GridViewRow
Form Post
QueryString
Data
Size
Any Size
Session
One user
Cache
Context
All users or a
subset of users
One user
ViewState
Config file
One user
All users
If you are binding the data in page load You no need to assign the datasource again else
you should assign the datasource here
You can find or handle the above two events in global.asax file. Session_Start event will
trigger when ever new session start. Similarly Session_End event trigger when a session
is abandoned or expires.
<configuration>
<system.web>
<sessionState cookieless="true"
regenerateExpiredSessionId="true" />
</system.web>
</configuration>
ASP.NET maintains cookieless session state by automatically inserting a unique session
ID into the pages URL. Then URL will looks like
Explain the validation controls. How many validation controls in ASP.NET 4.0?
Validation controls are responsible to validate the data of an input control. Whenever
you provide any input to an application, it performs the validation and displays an error
message to user, in case the validation fails.
Printed