ASP

What is ASP (Active Server Pages)?
ASP is a server side-scripting environment for building dynamic and interactive web pages. Since the scripts run on the server side, the web server does all the processing.

What is an .ASP file?
It is a Text File that contains the combination of the following:
• Text
• HTML tags
• Script Commands

What is the difference between ASP and HTML? Or Why ASP is better than HTML?
• ASP executes code on the server side whereas the browser interprets HTML.
• ASP can use any scripting languages
• Gets feedback from the user and return information to the user
• Create pages that will be customized to display only things that will be of interest to a particular user
• Can edit contents of a web page by updating a text file or a database rather than the HTML code itself

What are the differences between ASP and ASP.NET and is ASP.NET backward compatible to ASP.
ASP page is non compiled version ie the ASP compiler (interpreter) executes each line of ASP page when the request for a particular page is made...
Where as ASP.NET page is the pre-compiled version. When we compile the ASP.NET page, the .NET compiler compiles the ASP.NET page to the UI assemply.

How can you change the primary scripting language for a page?
Specify <%@ LANGUAGE = Scripting language %>
How are scripts executed?
ASP provides scripting engines that execute the corresponding scripting languages on the server side. Scripts should be encoded within the <%…. %>Delimiters.

What are the advantages of using ASP?
• Minimizes network traffic by limiting the need for the browser and server to talk to each other
• Makes for quicker loading time since HTML pages are only downloaded
• Allows to run programs in languages that are not supported by the browser
• Can provide the client with data that does not reside on the client’s machine
• Provides improved security measures since the script cannot be viewed by the browser

What is a "Virtual Directory"?
Virtual directories are aliases for directory paths on the server. It allows moving files on the disk between different
folders, drives or even servers without changing the structure of web pages. It avoids typing an extremely long URL each time to access an ASP page.

What are the browsers that can access ASP pages?
• Internet Explorer (supports VBScript, JavaScript)
• Netscape Communicator/ Navigator (supports only JavaScript, VBScript can be also added too)

How does the server identify and execute the server-side scripts within HTML code?
• Including the RUNAT=SERVER attribute in the
tag
• Use <% … %>server script delimiter

What is the difference between Cookies collection and Form/Querystring collection?
Cookie collection does not have the Count property.
Cookies can have multiple values for the same cookie name but each value can be referred using a key whereas in a Form/Querystring cookie each value has to be referred using an index value.


What is ServerVariables collection?
The ServerVariables collection holds the entire HTTP headers and also additional items of information about the server.

What are the collections of Session Object?
• Contents collection – contains all the variables established for a session without using thetag.
• Static collection – contains all the objects created with thetag within session scope.

What are the collections of Application Object?
* Contents collection – contains all variables added via scripts in global.asa.
* Static collection – contains the names of all objects added via thetag in global.asa.

What are the attributes of the
tags? What are their functions?
The two attributes are ACTION and METHOD
The ACTION gives the name of the ASP file that should be opened next by which this file can access the information given in the form
The METHOD determines which of the two ways (POST or GET) the browser can send the information to the server.

What is ServerVariables collection?
The ServerVariables collection holds the entire HTTP headers and also additional items of information about the server.

What is Querystring collection?
This collection stores any values that are provided in the URL. This can be generated by three methods:
• By clicking on an anchor tag

• By sending a form to the Server by the GET method
• Through user-typed HTTP address

What is ClientCertificate collection?
A ClientCertificate is an encrypted number that is stored in a file on the user’s computer. This stores details of any security certificates included with the request.

What is Request Object?
Gets information from the user. It has five collections by which values can be accessed. They are: Querystring, Form, Cookies, Server Variables & ClientCertificate.

What is a FileSystemObject object?
It provides access to the physical file system of the web server. It gets and manipulates information about
all drives in a server, folders and sub-folders on a drive and files inside a folder.

What are the properties of Session Object?
• SessionID – returns the session identification number for each user.
• Timeout – sets the timeout period assigned to the Session object for any application, in minutes.
• CodePage – determines the code page that will be used to display content.
• LCID – a locale identifier, which determines time zone and language, rules for the system.

Explain the POST & GET Method or Explain the difference between them.
POST METHOD:
The POST method generates a FORM collection, which is sent as a HTTP request body. All the values typed in
the form will be stored in the FORM collection.
GET METHOD:
The GET method sends information by appending it to the URL (with a question mark) and stored as A Querystring collection. The Querystring collection is passed to the server as name/value pair.
The length of the URL should be less than 255 characters.

What are the methods by which output stream is controlled?
• Flush – sends previous buffered output to the client immediately, but continues processing the script.
• Clear – erases any already-buffered HTML.
• End – causes the server

What are the properties used to control the expiration of the page?

• Expires – specifies the number of minutes before a page cached on a browser expires.
• ExpiresAbsolute – sets the date and time at which a page cached on a browser expires.

What are the ASP Scripting Objects?
The Dictionary object, the FileSystemObject object, TextStream object.

What is the difference between server.trasfer, server.execute and Response.redirect?
Is Response.trasfer is valid in ASP.
server.execute stops the execution of the current page and transfers the control to the URL passed in as a parameter. After that page has finished execution control passes back to the original page and execution resumes at the statement after the execute method call.

server.transfer is similar to server.execute but unlike that methos the execution does not resume to the original page but end when the new page completes executing

response.redirect transfers the control to the given url but there is server round trip.
In response.redirect the new url can be seen , but in server.execute and transfer the new page url is not seen even though the control is passed to the new page.

Performance is better in server.execute and transfer nut they cannot be used with server-side include #exec directive.

What is the function of Buffer in Response Object?
Buffer controls the HTML output stream manually.
Respose.buffer=False/True
Buffer is used to send the information to the browser.

How to Retrieve a Cookie Value?
The "Request.Cookies" command is used to retrieve a cookie value. <% fname=Request.Cookies("firstname") response.write("Firstname=" & fname) %>

When does a Session Start?
A session starts when:
• A new user requests an ASP file, and the Global.asa file includes a Session_OnStart procedure
• A value is stored in a Session variable
• A user requests an ASP file, and the Global.asa file uses thetag to instantiate an object with session scope

When does a Session End?
A session ends if a user has not requested or refreshed a page in the application for a specified period. By default, this is 20 minutes.
If you want to set a timeout interval that is shorter or longer than the default, you can set the Timeout property.

What happens to ASP pages?
The browser makes a HTTP request; the server does the processing and gives a HTML response to the browser.

What are LOCAL and GLOBAL variables?
Local variables lifetime ends when the Procedure ends. Global variables lifetime begins at the start of the
script and ends at the end of the script and it can be used by any procedure within the script. Declaring a
variable by using the keyword PRIVATE makes the variable global within the script, but if declared using PUBLIC, then all scripts can refer the variable.

How to handle Error in ASP ?
Using On Error Goto.

Can two different applications use the same GLOBAL.ASA File?
No,each application can have their own Global.asa file but it can't be shared.

What is the Default ScriptTimeOut for Server Object?
The ScriptTimeout property specifies the amount of runtime in seconds for a script before it terminates. The default value is 90 seconds.

What is the difference between Server-side validation and Client-side validation?
1. Client-side is faster than server-side as the networking time from client to server is saved
2. server-side is done on the server. Then the server converts the data into an html page and sends to the browser.
3. server-side is more secure as the user cannot see the code even he does a view-source.

What is a Dictionary object?
It lets you store and retrieve information in a flexible data structure. Each value or information stored in a Dictionary is associated with a key through which the information can be retrieved.

What purpose is served by the Application.Lock method?
It locks the Application object, preventing other clients from altering any values in the Contents collection.

Which is the default Scripting Language on the client side?
JavaScript.

What is Extranet?
An area of a web site available only to a set of registered visitors.

Which is the default Scripting Language of ASP on the Server side?
VBScript.

No comments: