Create an Active Server Page to delete messages from a forum. This ASP should take a f orum’s f ilename a nd t he t imestamp o f the m essage a s f orm arguments. M odif y formatting. xsl to provide a link to the ASP for each message. [Hint: To remove an element’s child, use removeChild, with the node to remove as a parameter.]
What will be an ideal response?
```
1 <% @LANGUAGE = "VBScript" %>
2 <% Option Explicit %>
3
4<% ' Exercise 15.3 : deletePost.asp %>
5
6<%
7 Dim xmlFile, xmlRoot, xmlNodes, xmlItem
8 Dim strPath, strTime
9
10 If Request( "id" ) <> Empty And _
11 Request( "file" ) <> Empty Then
12
13 Call Application.Lock()
14
15 strPath = Server.MapPath( Request( "file" ) )
16
17 Set xmlFile = Server.CreateObject( "Microsoft.XMLDOM" )
18 xmlFile.Async = False
19
20 If Not xmlFile.Load( strPath ) Then
21 Call Application.Unlock()
22 Call Response.Redirect( "invalid.html" )
23 End If
24
25 Set xmlRoot = xmlFile.DocumentElement
26 Set xmlNodes = xmlRoot.ChildNodes
27
28 For Each xmlItem In xmlNodes
29 strTime = xmlItem.getAttribute( "timestamp" )
30
31 If strTime = Request( "id" ) Then
32 Call xmlRoot.RemoveChild( xmlItem )
33 End If
34 Next
35
36 Call xmlFile.Save( strPath )
37 Call Application.Unlock()
38 End If
39
40 Response.ContentType = "text/xml"
You might also like to view...
The cell in which the user is currently entering data is called the active cell
Indicate whether the statement is true or false
Which of the following ICMP Types is used for Echo Request packets?
A. ICMP Type 2 B. ICMP Type 4 C. ICMP Type 6 D. ICMP Type 8
The term ________ refers to the process of compressing files or folders
A) extrude B) unzip C) extract D) zip
Which feature enables you to select and drag items without pressing the mouse button?
A) ButtonLock B) MouseLock C) DragLock D) ClickLock