Pages

Monday, July 23, 2012

Server object in Asp

The Asp Server Object can store user defined variables . The variables stored in the Server object are common to all the web pages on the web server. This enables the value to be the same for all the users on all the pages. The Server object contains only one property, ScriptTimeOut. You can use the property  to set the time for which a script is allowed to execute by a server , before it is stopped. For Example, you can specify :-
<% Server.ScriptTimeout  = 50   % >
The previous statement indicates it will allow scripts to run for 50 seconds. The Server will Terminate scripts after 50 seconds  and display an error message This property is useful when a Script is executing a loop with  very high values or waiting for resource to be free. By default the for Scripttimeout property is set to 90 seconds.

ASP SERVER OBJECT METHODS
Method Description
CreateObject Creates an instance of an object
Execute Executes an .asp files
URLEncode Converts a string into the proper format for HTTP paramater passing with escape characters
HTMLEncode Convers HTML string characters to be displayed on a browser instead of being interpreted
MapPath convert a virtual path to phyiscal path
Transfer Transfer control to another ASP page. It does not create a new object context
GetLastError Returns an instance of the ASPError object


Thursday, July 5, 2012

Err Objects Asp (Vbscript)

Error objects 
There are 2 error objects that you can use to handle the errors that occur while creating and executing ASP Code.
  • Err Object
  • ASPError Object 
The err object contains information about runtime errors. It is built in object provided with ASP 2.0 and works with ASP 3.0  You can use the properties of the Err object ot check for errors. For example to raise an error, you need to use the Err.Raise method with appropriate paramaters.

Wednesday, July 4, 2012

On Error Resume Next Asp Vbscript

On Error Resume next Asp

Error Handling using the on error resume next statement asp

The on Error resume next statement in code tells ASP to skip the error and execute the next line of code, instead of stopping the execution of the script. There, a script is completely executed even if there is errors.

Tuesday, July 3, 2012

Types of Error Asp

Identifying the types of Errors in asp

Types of Errors in Asp
  1. Compilation error in asp
  2. Run time error in asp
  3. Logical error in asp
Suppose a visitor to a web page sees the following error message:-
"Microsoft OLE DB Provider for ODBC Drivers error "80004005" [Microsoft][ODBC MICROSOFT ACCESS 97 Driver] The Microsoft jet database engine cannot open the file '(unknown)'. It is already opened opened exclusively by another user, or you need permission to view its data."
Such error prevent visitors from viewing Web pages properly and annoy them. Errors can spoil a well written code in asp. There fore  error handling in asp is extremely important point