ASP Questionnaire
Date: March 31,2003 Author: ravindra Sadaphule
Number: Heading: Question: Answer:
1 IIS What is ISAPI filter? An ISAPI filter is a custom dll that is called by web server in reponse to every http request. In this way, the ISAPI filter changes the manner in which web server itself behaves. The ISAPI filter then instructs the web server how to handle the request. ISAPI filters thus allow to customize web server‟s response. ISAPI dll can be written only in C++. TL
Comments: Level:
Number: Heading: Question: Answer: Comments: Level:
2 ASP Object Model
Response.CacheControl = "Public". What is the result if a client loads a page with the code above .
The page is cached on proxy server. SE
Number: Heading: Question:
3 ASP Object Model
<% SET Conn = Server.CreateObject( "ADODB.Connection" ) Conn.Open "DSN=db1" sSQL = "SELECT field1 FROM table1" Set rsTest = Conn.Execute(sSQL) RsTest.MoveFirst Do Until rsTest.EOF Response.write rsTest(0) & "
" Loop
%> Assuming the connection and SQL are valid and table1 has at least one row, what is the result of the above code?
Answer: Comments: Level:
Script timeout error SE
Number: Heading: Question:
4 ASP Object Model
Function encodeCheck(encodeVar) If Not IsNull(encodeVar) Then encodeCheck = Server.HtmlEncode(encodeVar) Else encodeCheck = "" End If Response.write enclodecheck End Function Why is the above code necessary when dealing with values obtained from a database?
Answer: Comments: Level:
To prevent browser from interpreting special html characters contained in variable encodevar SSE
Number: Heading: Question: Answer:
5 ASP Error Handling
On Error goto 0 On Error Resume Next What is the result of including the code in the sample above in a page?
On error goto 0 In this case preprocessing, syntax errors and runtime errors are captured by IIS and execution will be redirected to page 500-100.asp .
On Error Resume Next
In this case preprocessing, syntax errors are captured by IIS and execution will be redirected to page 500-100.asp . Runtime errors will not cause IIS to redirect to 500-100.asp page. Comments: Level: SE
Number: Heading: Question: Answer: Comments: Level:
6 ASP Object Model
What do you use in order to determine if the cookie "FavoriteMovies" in the Request object contains more than one entry? Request.Cookies("FavoriteMovies").HasKeys
SE
Number: Heading: Question: Answer: Comments: Level:
6 ASP objects model What are ASP intrinsic objects? There are 7 ASP intrinsic objects. They are Application, ASPError, ObjectContext, Request, Response, Server, Session. SE
Number: Heading: Question: Answer:
8 ASP Object Model Explain events of Application object. Application object has 2 events, Application_Onstart and Application_OnEnd . Application_Onstart fires when the first user requests page from application. Application_OnEnd fires when the web administrator unloads the application using Microsoft Management Console. SE
Comments: Level:
Number:
9
Heading: Question: Answer:
ASP object model Write a ASP subroutine that returns current date. Write ASP code that invokes this function and displays date returned. <% ….. Response.write GetDate …..%>
Comments: Level: SE
Number: Heading: Question: Answer: Comments: Level:
10 ASP Object Model How do u avoid conflict when 2 or more users attempt to modify application variable? Use Application.Lock, then modify the variable and then use Application.unlock. This essesntially serializes user requests. SE
Number: Heading: Question: Answer:
11 ASP object model How will u go about writing your own User Hit Counter for a website? Use Application variable say Application(“UserHitCounter”) to maintain the page hit counter. The value of UserHitCounter is incremented on Session_Onstart event . Since this variable is in memory, it could get destroyed if somebody stops IIS. Hence OnApplication_End event , this variable should be written into a file. Also In Application_Onstart event, this variable should be loaded from file. SSE
Comments: Level:
Number: Heading: Question:
12 ASP Object Model What will be values of dblPi and strCountry in following code <%… Application.Contents.Removeall Application.Contents(“pi”) = 3.1415567 Application.Contents(“Country”) = “India” Application.Contents(“State”) = “MH” Dim dblPi, strCountry DblPi = Application.Contents(0) StrCountry = Application.Contents(1) … %> DblPi will be initialized with undefined value. StrCountry = “3.1415567” This is because contents collection of application is 1 based and not 0 based SE
Answer:
Comments: Level:
Number: Heading: Question:
13 Asp Object Model What will be values of strFirst, strMiddle and strLast in following code <%…. Application.Contents.RemoveAll Application(“FirstName”)= “Ravindra” Application(“MiddleName”)= “Chandrakant” Application(“LastName”)= “Sadaphule” Application.Contents.Remve(“MiddleName”) Dim strFirst, strMiddle, strLast StrFirst = Application(1) StrMiddle = Application(2) StrLast = Application(3) %…>
Answer:
StrFirst = “Ravindra” StrMiddle = “Sadaphule” StrLast = undefines SE
Comments: Level:
Number: Heading: Question: Answer:
14 ASP Object Model What is staticobjects collection of application object? StaticObjects collection contains all of the objects added to the application through the use of