Definition of ASP.NET
Microsoft's ASP.NET is a server-side scripting technology that can be used to create dynamic and interactive Web applications. An ASP.NET page is an HTML page that contains server-side scripts that are processed by a web server before being sent to the user’s browser.
Since the server-side script is building a regular HTML page, it can be served to almost any browser.
Difference between ASP.NET AND ASP?
ASP.NET is contains complied code where as ASP contains Interpreted code.
ASP.NET is object oriented where as ASP is procedure oriented.
ASP.NET offers full compatibility with languages like Visual Basic, C# where as ASP does not.
ASP.NET provides you with access to over 3400 classes where as ASP only provide access to only five standard classes (Request, Response, Session, Server, Application)
In ASP Session state is only maintained if the client browser supports cookies but is not in the case for ASP.NET
In ASP we can Update files only when server is down where as in ASP.NET there is no need to down the server
In ASP the configuration information for an ASP web application (such as session state and server timeouts) is stored in the IIS metabase. It can only be modified on the server machine with utilities such as the Internet Service Manager where as in ASP.NET configuration information stored on XML based configuration files so it can be easily movable.
ASP.NET pages only support one language on a single page, because of ASP Net's compiled nature where as ASP allowed multiple languages to be used on a single page. (However, it is still possible in ASP.NET to have multiple pages, each with a separate language, within a single application)
Advantages of ASP.NET
Separation of Code from HTML
To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently.
Support for Compiled languages
Developer can use VB.NET and access features such as strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) compiled when first requested. Subsequent requests are directed to the fully compiled code, which is cached until the source changes.
Use services provided by the NET Framework
The .NET Framework provides class libraries that can be used by your application. Some of the key classes help you with input/output, access to operating system services, data access, or even debugging. We will go into more detail on some of them in this module.
Graphical Development Environment
Visual Studio .NET provides a very rich development environment for Web
developers. You can drag and drop controls and set properties the way you do in Visual Basic 6. And you have full IntelliSense support, not only for your code, but also for HTML and XML.
State management
To refer to the problems mentioned before, ASP.NET provides solutions for session and application state management. State information can, for example, be kept in memory or stored in a database. It can be shared across Web forms, and state information can be recovered, even if the server fails or the connection breaks down.
Update files while the server is running!
Components of your application can be updated while the server is online and clients are connected. The Framework will use the new files as soon as they are copied to the application. Removed or old files that are still in use are kept in memory until the clients have finished.
XML-Based Configuration Files
Configuration settings in ASP.NET are stored in XML files that you can easily read and edit. You can also easily copy these to another server, along with the other files that comprise your application.
Some features of ASP.NET
Crash protection
ASP.NET has been designed to handle your memory leaks efficiently, whenever a memory leak is detected ASP.NET creates another copy of itself, all new requests are directed to this new copy, the older copy is deleted along with the memory leak it created when it finishes executing the pending processes.
Caching
ASP.NET allows you to build web applications that are fast, it does that by caching of compiled code, i.e. certain pages can be cached into the memory, so that they don’t take a longer time to retrieve, now the trick here is that this code is compiled, this is it is already converted into a machine readable format.
Code Access Security
IPv6 support
support for running multiple versions of ASP.NET side-by-side
New server controls
Server Controls in ASP.NET
HTML Server Controls
Web Server Controls(enable view state and automatic postback control extra compare to HTML server control)
Validation Controls
User Controls and Custom Controls (user control stored in ascx file also no vs design time support )
Explain the differences between Server-side and Client-side code?
Server-side code executes on the server. Client-side code executes in the context of the clients' browser.
What are some ways to manage state in an ASP.NET application?
Session objects, Application objects, ViewState, cookies, hidden form fields.
What does the "EnableViewState" property do? Why would I want it on or off?
It allows page objects to save their state in a Base64 encoded string in the page HTML. One should only have it enabled when needed because it adds to the page size and can get fairly large for complex pages with many controls. (It takes longer to download the page).
What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers execution directly to another page. Response.Redirect sends a response to the client and directs the client (the browser) to load the new page (it causes a roundtrip). If you don't need to execute code on the client, Transfer is more efficient.
How can I maintain Session state in a Web Form or Web Garden?
Use a State Server or SQL Server to store the session state.
What base class do all WebForms inherit from?
The Page class.
What does WSDL stand for?What does it do?
WSDL stands for Web Services Description Language. It describes the interfaces and other information of a web service.
Which WebForm Validator control would you use if you needed to make sure the values in two different Web Form controls matched?
Compare Validator Control
What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?
You must set the DataSource property and call the DataBind method.
Describe the role of inetinfo.exe, ASPnet_isapi.dll and ASPnet_wp.exe in the page loadingprocess.
inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an ASP.NET request is received (usually a file with .ASPx extension), the ISAPI filter ASPnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.
What’s the difference between Response.Write() and Response.Output.Write()?
Response.Output.Write() allows you to write formatted output.
What methods are fired during the page load?
Init() - When the page is instantiated
Load() - When the page is loaded into server memory
PreRender() - The brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.
When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.
What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page
Where do you store the information about the user’s locale?
System.Web.UI.Page.Culture
What’s the difference between Codebehind="MyCode.ASPx.cs" andSrc="MyCode.ASPx.cs"?
CodeBehind is relevant to Visual Studio.NET only.
What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?
Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
What data types does the RangeValidator control support?
Integer, String, and Date.
What type of code (server or client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser.
But just to be clear, code-behind executes on the server, thus making it server-side code.
Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.
Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
A DataSet is designed to work without any continuing connection to the original data source.
Data in a DataSet is bulk-loaded, rather than being loaded on demand.
There's no concept of cursor types in a DataSet.
DataSets have no current record pointer You can use For Each loops to move through the data.
You can store many edits in a DataSet, and write them to the original data source in a single operation.
Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.
Describe the difference between inline and code behind.
Inline code written along side of html in a page. Code-behind is code written in a separate file and referenced by the .ASPx page.
Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.
Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.
Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.
Can you edit data in the Repeater control?
No, it just reads the information from its data source.
Which template must you provide, in order to display data in a Repeater control?
ItemTemplate.
How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate.
What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
You must set the DataSource property and call the DataBind method.
Name two properties common in every validation control?
ControlToValidate property and Text property.
Which property on a Combo Box do you set with a column name, prior to setting the Data Source, to display data in the combo box?
DataTextField property.
Which control would you use if you needed to make sure the values in two different controls matched?
CompareValidator control.
How many classes can a single .NET DLL contain?
It can contain many classes.
Web Service Questions
What is the transport protocol you use to call a Web service?
SOAP (Simple Object Access Protocol) is the preferred protocol.
True or False: A Web service can only be written in .NET?
False
Where on the Internet would you look for Web services?
http://www.uddi.org
True or False: To test a Web service you must create a Windows application or Web application to consume this service?
False, the web service comes with a test page and it provides HTTP-GET method to test.
State Management Questions
What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.
What is the lifespan for items stored in ViewState?
Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).
What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.
What are the different types of Session state management options available with ASP.NET?
Application - Global For Entire Application
Session - Any Used For Single User Session
Viewstate - Used For Automatic Postback Persistence
Hidden - Used To Pass Value To Javascript.
Querystring - Only One Page Possible, Send With URL
Cookies - Permenant Information
Explain about Web User Control and a Web Custom Control.
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.
Web custom controls are compiled components that run on the server and encapsulate the 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 to 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.
Like Web Forms, user controls can be created in the visual designer or they can be written with code separate from the HTML. They can also support execution events.
However, since Web user controls are compiled dynamically at run time they cannot be added to the Toolbox and they are represented by a simple placeholder when added to a page.
Web custom controls are compiled code, which makes them easier to use but more difficult to create.
What is the difference between a Web User Control and a Web Custom Control?
The main difference between the two controls user controls are persisted as .ascx text files, whereas composite controls are compiled and persisted in assemblies.
In what order do the events of an ASPX page execute. As a developer is it important to undertsand these events?
1. Page_Init
2. Page_LoadViewState
3. Page_LoadPostData
4. Page_Load
5. Page_RaisePostDataChanged
6. Page_RaisePostBackEvent
7. Page_PreRender
8. Page_SaveViewState
9. Page_Render
10. Page_Dispose
11. Page_Error (this is caused whenever there is an exception at the page level).
What method do you use to explicitly kill a user s session?
Session.Abandon
What tags do you need to add within the ASP:datagrid tags to bind columns manually?
You need to set AutoGenerateColumns Property to false.
What is a Singleton?
This ensures that a class can only be instantiated once.
How server handle our request?
Browser -> http instance-> pipeline to IIS-> inetinfo.exe (IIS server running-> check extension-> either ASP or ASP.NET -> if ASP.NET send-> aspnet_isapi.dll-> send->aspnet_wp.exe->put in CLR->execute.
What are the Session mode types available in ASP.NET?(session values are stored in memory like dictionary values ie keys and pairs)
InProc
Session maintained by aspnet_wp.exe. Not possible on load balancing server.so that time we go for OutProc
OutProc
Session are serialized and stored in separate process.
Two types of OutProc
State Server
o Session stored in aspnet_state.exe.
o It can not start automatically. Go to windows/.net/framework/1.1/type net start aspnet_state.exe
o it’s a tempory storage
SqlServer state
o Go to windows/.net/framework/1.1/type
o Find the file “installsqlstate” script file. Open it on the sql server. Run it. It create 3 tables and more than 10 stored procedures now session stored in sql server.
o Its permenant
Is possible we use ASP session value in ASP.NET?
Directly not possible. Indirectly 2 ways
Store on db and import on ASP.NET
Store on hidden variable and take on next page(redirect from ASP to ASP.NET application)
How to convert dll to lib and lib to dll?
Is called com callable wrap(CCW)
Lib to dll
Tlbimp a.lib it give dll file->create sn
Dll to lib
Tlbemp ss.dll -> it give lib file-> add it in vb lib reference
What is an RCW(runtime callable wrap)
Used to call unmanaged code such as winapi ex user32.dll and shock.dll.
Shock.dll used to deploy IE in windows.
What are the different types of Directives available in ASP.NET?
@ Assembly Declaratively links an assembly to the current page or user control.
@ Control Defines control-specific attributes used by the ASP.NET page parser and compiler. Can only be included in .ascx files ( user controls ).
@ Implements Declaratively indicates that a page or user control implements a specified .NET Framework interface.
@ Import Explicitly imports a namespace into a page or user control.
@ OutputCache Declaratively controls the output caching policies of a page or user control.
@ Page Defines page-specific attributes used by the ASP.NET page parser and compiler. Can only be included in .aspx files.
@ Reference Declaratively links a page or user control to the current page or user control.
@ Register Associates aliases with namespaces and class names, thereby allowing user controls and custom server controls to be rendered when included in a requested page or user control.
Updating Datasets and Data Stores
When changes are made to records in the dataset, the changes have to be written back to the database. To write changes from the dataset to the database, you call the Update method of the data adapter that communicates between the dataset and its corresponding data source.
The DataRow class used to manipulate individual records includes the RowState property, whose values indicate whether and how the row has been changed since the data table was first loaded from the database. Possible values include Deleted, Modified, New, and Unchanged. The Update method examines the value of the RowState property to determine which records need to be written to the database and what specific database command (add, edit, delete) should be invoked.
Monday, December 3, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment