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"

Computer Science & Information Technology

You might also like to view...

Which DirectoryChooser method returns the folder the user selected?

a. getSelectedfolder. b. showDialog. c. getOpenDialog. d. showOpenDialog.

Computer Science & Information Technology

What is a one-way function? Provide an example or an analogy to help explain the concept.

What will be an ideal response?

Computer Science & Information Technology