1.What are server controls?
ASP.NET server controls are components that run on the server and encapsulate user-
interface and other related functionality. They are used in ASP.NET pages and in
ASP.NET code-behind classes.
2.What is the difference between Web User Control and Web Custom Control?
Custom Controls
Web custom controls are compiled components that run on the server and that
encapsulate user-interface and other related functionality into reusable packages. They
can include all the design-time features of standard ASP.NET server controls, including
full support for Visual Studio design features such as the Properties window, the visual
designer, and the Toolbox.
There are several ways that you can create Web custom controls:
There are several ways that you can create Web custom controls:
•
You can compile a control that combines the functionality of two or more existing
controls. For example, if you need a control that encapsulates a button and a text
box, you can create it by compiling the existing controls together.
•
If an existing server control almost meets your requirements but lacks some
required features, you can customize the control by deriving from it and
overriding its properties, methods, and events.
•
If none of the existing Web server controls (or their combinations) meet your
requirements, you can create a custom control by deriving from one of the base
control classes. These classes provide all the basic functionality of Web server
controls, so you can focus on programming the features you need.
If none of the existing ASP.NET server controls meet the specific requirements of your
applications, you can create either a Web user control or a Web custom control that
encapsulates the functionality you need. The main difference between the two controls
lies in ease of creation vs. ease of use at design time.Web user controls are easy to make,
but they can be less convenient to use in advanced scenarios. You develop Web user
controls almost exactly the same way that you develop Web Forms pages. Like Web
Forms, user controls can be created in the visual designer, they can be written with code
separated from the HTML, and they can handle execution events. However, because Web
user controls are compiled dynamically at run time they cannot be added to the Toolbox,
and they are represented by a simple placeholder glyph when added to a page. This
makes Web user controls harder to use if you are accustomed to full Visual Studio .NET
design-time support, including the Properties window and Design view previews. Also,
the only way to share the user control between applications is to put a separate copy in
each application, which takes more maintenance if you make changes to the control.Web
custom controls are compiled code, which makes them easier to use but more difficult to
create; Web custom controls must be authored in code. Once you have created the
control, however, you can add it to the Toolbox and display it in a visual designer with
full Properties window support and all the other design-time features of ASP.NET server
controls. In addition, you can install a single copy of the Web custom control in the
global assembly cache and share it between applications, which makes maintenance
easier.
Web user controls
•
Easier to create
•
Limited support for consumers who use a visual design tool
•
A separate copy of the control is required in each application
•
Cannot be added to the Toolbox in Visual Studio
•
Good for static layout
Web custom controls
•
Harder to create
•
Full visual design tool support for consumers
•
Only a single copy of the control is required, in the global assembly cache
•
Can be added to the Toolbox in Visual Studio
•
Good for dynamic layout
3.Application and Session Events?
The ASP.NET page framework provides ways for you to work with events that can be
raised when your application starts or stops or when an individual user's session starts or
stops:
•
Application events are raised for all requests to an application. For example,
Application_BeginRequest is raised when any Web Forms page or XML Web
service in your application is requested. This event allows you to initialize
resources that will be used for each request to the application. A corresponding
event, Application_EndRequest, provides you with an opportunity to close or
otherwise dispose of resources used for the request
•
Session events are similar to application events (there is a Session_OnStart and a
Session_OnEnd event), but are raised with each unique session within the
application. A session begins when a user requests a page for the first time from
your application and ends either when your application explicitly closes the
session or when the session times out
4.Difference between ASP Session and ASP.NET Session?
asp.net session supports cookie less session & it can span across multiple servers.
5.What is cookie less session? How it works?
By default, ASP.NET will store the session state in the same process that processes the
request, just as ASP does. If cookies are not available, a session can be tracked by adding
a session identifier to the URL. This can be enabled by setting the following:
http://samples.gotdotnet.com/quickstart/aspplus/doc/stateoverview.aspx
6.How you will handle session when deploying application in more than a server?
Describe session handling in a webfarm, how does it work and what are the limits?
By default, ASP.NET will store the session state in the same process that processes the
request, just as ASP does. Additionally, ASP.NET can store session data in an external
process, which can even reside on another machine. To enable this feature:
•
Start the ASP.NET state service, either using the Services snap-in or by executing
"net start aspnet_state" on the command line. The state service will by default
listen on port 42424. To change the port, modify the registry key for the service:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\
Parameters\Port
•
Set the mode attribute of the section to "StateServer"
•
Configure the stateConnectionString attribute with the values of the machine on
which you started aspnet_state.
The following sample assumes that the state service is running on the same machine as
the Web server ("localhost") and uses the default port (42424): Note that if you try the
sample above with this setting, you can reset the Web server (enter iisreset on the
command line) and the session state value will persist.
7.What method do you use to explicitly kill a users session?
Abandon()
8.What are the different ways you would consider sending data across pages in ASP
(i.e between default.asp to default1.asp)?
•
Session
•
public properties
9.What is State Management in .Net and how many ways are there to maintain a
state in .Net? What is view state?
Web pages are recreated each time the page is posted to the server. In traditional Web
programming, this would ordinarily mean that all information associated with the page
and the controls on the page would be lost with each round trip. To overcome this
inherent limitation of traditional Web programming, the ASP.NET page framework
includes various options to help you preserve changes — that is, for managing state. The
page framework includes a facility called view state that automatically preserves property
values of the page and all the controls on it between round trips.However, you will
probably also have application-specific values that you want to preserve. To do so, you
can use one of the state management options.
Client-Based State Management Options:
•
View State
•
Hidden Form Fields
•
Cookies
•
Query Strings
Server-Based State Management Options:
•
Application State
•
Session State
•
Database Support
10.What are the disadvantages of view state / what are the benefits?
Automatic view-state management is a feature of server controls that enables them to
repopulate their property values on a round trip (without you having to write any code).
This feature does impact performance, however, since a server control's view state is
passed to and from the server in a hidden form field. You should be aware of when view
state helps you and when it hinders your page's performance.
11.When maintaining session through Sql server, what is the impact of Read and
Write operation on Session objects? will performance degrade?
Maintaining state using database technology is a common practice when storing user-
specific information where the information store is large. Database storage is particularly
useful for maintaining long-term state or state that must be preserved even if the server
must be restarted.
12.Explain the differences between Server-side and Client-side code?
Server side code will process at server side & it will send the result to client. Client side
code (javascript) will execute only at client side.
13.What are validator? Name the Validation controls in asp.net? How do u disable
them? Will the asp.net validators run in server side or client side? How do you do
Client-side validation in .Net? How to disable validator control by client side
JavaScript?
A set of server controls included with ASP.NET that test user input in HTML and Web
server controls for programmer-defined requirements. Validation controls perform input
checking in server code. If the user is working with a browser that supports DHTML, the
validation controls can also perform validation ("EnableClientScript" property set to
true/false) using client script.The following validation controls are available in
asp.net:RequiredFieldValidator Control, CompareValidator Control, RangeValidator
Control, RegularExpressionValidator Control, CustomValidator Control,
ValidationSummary Control.
14.Which two properties are there on every validation control?
ControlToValidate, ErrorMessage
15.How do you use css in asp.net?
Within the "" section of an HTML document that will use these styles, add a link to this
external CSS style sheet that follows this form: MyStyles.css is the name of your external
CSS style sheet.
16.How do you implement postback with a text box? What is postback and usestate?
Make AutoPostBack property to true
17.What is SQL injection?
An SQL injection attack "injects" or manipulates SQL code by adding unexpected SQL
to a query.Many web pages take parameters from web user, and make SQL query to the
database. Take for instance when a user login, web page that user name and password
and make SQL query to the database to check if a user has valid name and
password.Username: ' or 1=1 --- Password: [Empty]This would execute the following
query against the users table: select count(*) from users where userName='' or 1=1 --' and
userPass=''
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment