0% found this document useful (0 votes)
9 views

Dot Net 4

Dot net

Uploaded by

Siddhi Sonawane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Dot Net 4

Dot net

Uploaded by

Siddhi Sonawane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Dot net 4

Q1. ASP.NET?
• ASP.NET is a server-side technology used for developing dynamic websites
and web applications.
• ASP.NET aids developers to create web applications by using HTML, CSS,
and JavaScript
• ASP.NET is the latest version of Active Server Pages, which Microsoft
developed to build websites.
• It is a web application framework released in 2002 and had an extension of
.aspx.

Q2. Why ASP.NET?


• ASP.NET reduces all the issues that come up while building a web
application like speed, cost, and language.
• ASP.NET provides multiple development modes, which help to develop
applications in an easy and better way
• ASP.NET works on an HTTP protocol and uses HTTP commands.
• ASP.NET provides a platform that allows writing a code in a text editor
program and Visual Studio .NET.

Q3.ASP.NET Page Life Cycle


• When a page is requested, it is loaded into the server memory, processed,
and sent to the browser.Then it is unloaded from the memory At each of
these steps, methods and events are available, which could be overridden
according to the need of the application
• The page life cycle phases are:
1. Initialization
2. Instantiation of the controls on the page
3. Restoration and maintenance of the state
4. Execution of the event handler codes
5. Page rendering
• Following are the page life cycle events:
1. PreInit: Prelnit is the first event in page life cycle. It checks the IsPostBack
property and determines whether the page is a postback. The event can be
handled by overloading the OnPretinit method of creating a Page Prelnit
handler
2. Init: Init event initailizes the control property and the control tree is built.
This event can be handled by overloading the Oninit method or colesting a
Page Init handler.
3. InitComplete: InitComplete event allows tracking of view state. All the
controls turn on view-state tracking.
4. LoadViewState: LoadViewState event allows loading view state information
into the controls.
5. LoadPostData: During this phase, the contents of all the input fields are
defined with the <form> tag are processed.
6. PreLoad: PreLoad occurs before the post back data is loaded in the
controls. This event can be handled by overloading the OnPreload method
or creating a Page PreLoad handler.
7. Load: The Load event is raised for the page first and then recursively for all
child controls. The controls in the control tree are created. This event can
be handled by overloading the OnLoad method or creating a Page_Load
handler.
8. LoadComplete: The loading process is completed, control event handlers
are run. and page validation takes place. This event can be handled by
overloading the OnLoadComplete method or creating a
Page_LoadComplete handler
9. PreRender: The PreRender event occurs just before the output is rendered.
By
10. handling this event, pages and controls can perform any updates before the
output is rendered.
11. PreRenderComplete: As the PreRender event is recursively fired for all child
controls, this event ensures the completion of the pre-rendering phase.
12. SaveStateComplete: State of control on the page is saved. Personalization
control state and view state information is saved. The HTML markup is
generated. This stage can be handled by overriding the Render method on
creating a Page_Render handler.
13. UnLoad: The UnLoad phase is the last phase of the page life cycle. It raises
the UnLoad event for all controls recursively and lastly for the page itself.
Fina cleanup is done and all resources and references, such as database
connections are freed. This event can be handled by modifying the
OnUnLoad method c creating a Page_UnLoad handler.

Q4.ASP.NET ARCHITECTURE
The architecture of the Net framework is based on the following key components:
1. Language: A variety of languages exists for .net framework. They are VB.net
and C#. These can be used to develop web applications.
2. Library: The.NET Framework includes a set of standard class libraries. The most
common library used for web applications in net is the Web library. The web
library has all the necessary components used to develop Net web-based
applications.
3. Common Language Runtime: The Common Language Infrastructure or CLI is a
platform. .Net programs are executed on this platform. The CLR is used for
performing key activities. Activities include Exception handling and Garbage
collection.

Q5.HTML controls
1. Button: It is used to create HTML button.
2. Reset Button: Resets all other HTML form elements on a form to a default
value
3. Submit Button: Automatically POSTs the form data to the specified page
listed in the Action attribute in the FORM tag
4. Text Field: Gives the user an input area on an HTML form
5. Text Area: Used for multi-line input on an HTML form
6. CheckBox: Gives the user a check box that they can select or clear
7. Radio Button: Used two or more to a form, and allows the user to choose
one of the controls
Q6. Properties and Methods of HTTPRequest Class
• Following are some of the important properties of the HttpRequest class
1.Path: This property retrieves the virtual path of the current request.Path
retrieves the path of the current URL request.The method Response.Write()
displays the retrieved path.
2.PathInfo:This property retrieves the additional path information of the current
request retrieves the information only for resources that have a URL extension.
Syntax is:public string PathInfo { get };
3.UserAgent:This property retrieves the user agent string of the client browser. C
4.UserHostAddress:This property retrieves the host Internet Protocol (IP) address
of the remote client who makes the request.
5.TotalByte(): This property retrieves the number of bytes in the current input
stream.
6. BinaryRead(): This method is used to retrieve the data sent to the server from
the client.
7. GetType(): This method retrieves the type of the current instance.
Q7. Properties of server object
1. MachineName: Name of server computer
2. ScriptTimeOut: Gets and sets the request time-out value in seconds.

Q8.Method of server object


1. CreateObject(String): Creates an instance of the COM object identified by
itsProgID (Programmatic ID).
2. CreateObject(Type): Creates an instance of the COM object identified by its
Type
3. Equals(Object): Determines whether the specified Object is equal to current
Object.
4. Execute(String): Executes the handler for the specified virtual path context
of the current request.
Q9. Properties of response object
• Charset: Gets or sets the HTTP character set of the output stream.
• ContentEncoding:Gets or sets the HTTP character set of the output stream.
• Content Type: Gets or sets the HTTP MIME type of the output stream.
• Cookies: Gets the response cookie collection.
• Expires: Gets or sets the number of minutes before a page cached on a
browser expires.
Q10. methods of response object.
• AddHeader: Adds an HTTP header to the output stream AddHeader is
provided for compatibility with earlie versions of ASP.
• AppendHeader: Adds an HTTP header to the output stream.
• BinaryWrite: Writes a string of binary characters to the HTTP output
stream.
• ClearContent: Clears all content output from the buffer stream
• Equals(Object): Determines whether the specified object is equal to the
current object.
• Flush: Sends all currently buffered output to the client.

Q10. ASP.NET Event Handling


• An event is an action or occurrence such as a mouse click, a key press,
mouse movements, or any system-generated notification.
• A process communicates through events.
• When events occur., the application should be able to respond to it and
manage it. Events in ASP.NET raised at the client machine, and handled at
the server machine
• The server has a subroutine describing what to do when the event is raised;
it is called the event-handler.
• The common control events of event handling are:
Q11. Web Controls
• Web controls are basically HTML elements wrapped under easy to use
scripting tags of ASP+ and provide rich functionality in your FORMS or
pages.
• Web controls range from simple text box to advance girds and lists.
• Some of the controls like data grid can be bound to data sources much like
Visual Basic data bound controls.

Q12. advantages of web controls


• They are highly customizable and provide common properties and methods
throughout.
• Even though web controls provide rich functionality finally they are
rendered as plain HTML in the client browser thus avoiding browser
compatibility problems.
• They can be used in object oriented manner much like Visual Basic controls.
• They are processed at server side. This makes ASP+ page much readable
and cleaner as compared to traditional ASP page.
• They can be data bound.
• State maintenance is automatically taken care by ASP+
Q.ASP.NET - Validation
• ASP.NET validation controls validate the user input data to ensure that
useless, unauthenticated, or contradictory data don't get stored.
• ASP.NET provides following validation controls:
1. RequiredFieldValidator
2. RangeValidator
3. CompareValidator
4. RegularExpressionValidator
5. CustomValidator
6. ValidationSummary
• why we use validation controls? : Validation is important part of any web
application. User's input must always be validated before sending across
different layers of the application.

Q.ASP.NET - Server Controls


• Server Controls are the tags that are understood by the server.
• There are basically three types of server controls.
1. HTML Server Controls: Traditional HTML tags.
2. Web Server Controls: New ASP. NET tags.
3. Validation Server Controls: For input validation.
1. ASP.NET HTML Server Controls:
• ASP.NET provides a way to work with HTML Server controls on the server
side programming with a set of controls collectively is called HTML
Controls.
• These controls are grouped together in the Visual Studio Toolbox in the
HTML Control tab. The markup of the controls is similar to the HTML
control.
• These controls are basically the original HTML controls but enhanced to
enable server side processing.
• The following table describes the HTML server controls:
2. HtmlHead: <head>element
3. HtmlInput Button: <input type=button submit reset>
4. HtmlInputCheckbox: <input type=checkbox>
5. HtmlInputFile: <input type=file>
6. HtmlInputHidden: <<input type=hidden>
7. HtmlInputImage: <input type=image>
8. HtmlInputPassword: <input type=password>
9. HtmlInputRadioButton: <input type=radio>
10. HtmlInputReset: <input type=reset>
Q. Client Side Control
ASP.NET client side coding has two aspects:
1. Client side scripts
It runs on the browser and in turn speeds up the execution of page. For example,
client side data validation which can catch invalid data and warn the user
accordingly without making a round trip to the server.
2. Client side source code
ASP.NET pages generate this. For example, the HTML source code of an ASP.NET
page contains a number of hidden fields and automatically injected blocks of
JavaScript code, which keeps information like view state or does other jobs to
make the page work.
Q.The Menu Control
The menu control is a Navigation control, which is used to display the site
navigation information .
This can be used to display the side data Structure vertically and horizontally.
It can be used a binding control as TreeViewcontrol. Means we can easily bind
the XML and SiteMap data in menu control.
The menu control can be used as two types:
1.Static menu: It is used to display the parent menu items and their sub menu
items on the page. Means it is used to display the entire structure of the static
menu.
2. Dynamic menu: It is used to display the static menu as well as dynamic menu
items on the site. It Means when user passes the mouse over the menu then it
will appear on the site.

Q. What is state in asp.net and explain it's types


State management means to preserve state of a control, web page, object/data,
and user in the application explicitly because all ASP.NET web applications are
stateless, i.e., by default, for each page posted to the server, the state of controls
is lost. Nowadays all web apps demand a high level of state management from
control to application level.
ASP.NET manages four types of states:
View State
Control State
Session State
Application State
1.View State:
The view state is the state of the page and all its controls.
It is automatically maintained across posts by the ASP.NET framework.
When a page is sent back to the client, the changes in the properties of the page
and its controls are determined, and stored in the value of a hidden input field
named VIEWSTATE. When the page is again posted back, the_VIEWSTATE field is
sent to the server with the HTTP request.
2.Control State:
Control state cannot be modified, accessed directly, or disabled.
3.Session State:
When a user connects to an ASP.NET website, a new session object is created.
When a session state is turned on, a new session state object is created for each
new request.
This session state object becomes part of the context and it is available through
the page.
Session state is generally used for storing application data such as inventory,
supplier list, customer record, or shopping cart.
It can also keep information about the user and his preferences, and keep the
track of pending operations.
4.Application State:
The ASP.NET application is the collection of all web pages, code and other files
within a single virtual directory on a web server.
When information is stored in application state, it is available to all the users.
To provide for the use of application state, ASP.NET creates an application state
object for each application from the HTTPApplicationState class and stores this
object in server memory

You might also like