Introductory steps for ASP programming (13): Ad & Content Rot

Source: Internet
Author: User
Tags iis object model
The power of programming ASPs is not limited to accepting and displaying interactions, it is more about using ActiveX components for more powerful Web applications.
What exactly is an ActiveX component? And how does it work? The ActiveX server components is actually a file that exists on a WEB server that contains code to perform an item or a set of tasks, and components can perform common tasks so that you do not have to create the code that performs those tasks yourself. Very image of the word: the use of components to direct the use of other classic powerful program. It's just that the program has been encapsulated.

How does the specific ActiveX component come into being and how does it come about? The following three paths are generally available:
1, after installing the IIS server, some of the built-in components, such as the database connection component, are included.
2, get optional components from Third-party developers, or free or charge, such as some upload components (of course, there are no components to upload).
3, if you are a Web application developer, you can use the programming languages of Visual Basic, Java, Visual C + +, COBOL to write the ActiveX Server Component you need. This is the so-called ASP for COM (Component Object Model), COM + development.

Of course, whether the third party or the development of their own, before the use of the system must be registered. But these are something. What we need now is to get some of the components from the ASP as soon as possible.

However, before using the built-in components, first use a program to detect the component support in your own machine.
Refer to a popular "Arjunolic ASP Probe" on the Internet, save the following code as an ASP file for debugging viewing.

1,objcheck.asp

<%option Explicit%>
<%
Dim filename
Filename=request.servervariables ("Script_name")

Dim Objtotest (14,4)
Objtotest (0,0) = "MSWC." AdRotator "
Objtotest (0,1) = "Advertisement Wheel display Component"
Objtotest (1,0) = "MSWC." ContentRotator "
Objtotest (1,1) = "Content Wheel Display component"
Objtotest (2,0) = "MSWC." BrowserType "
Objtotest (2,1) = "Browser type display component"
Objtotest (3,0) = "MSWC." Nextlink "
Objtotest (4,0) = "MSWC." Tools "
Objtotest (5,0) = "MSWC." Status "
Objtotest (6,0) = "MSWC." Counters "
Objtotest (7,0) = "MSWC." IISLog "
Objtotest (8,0) = "MSWC." PermissionChecker "
Objtotest (9,0) = "Microsoft.XMLDOM"
Objtotest (10,0) = "Iissample.contentrotator"
Objtotest (11,0) = "Iissample.pagecounter"
Objtotest (12,0) = "Scripting.FileSystemObject"
Objtotest (13,0) = "Adodb.connection"

Public Isobj,verobj,testobj

Dim i
For I=0 to 13
On Error Resume Next
Isobj=false
Verobj= ""
Testobj= ""
Set Testobj=server. CreateObject (Objtotest (i,0))
If IsObject (testobj) Then
Isobj = True
Verobj = Testobj.version
If verobj= "" or IsNull (verobj) then Verobj=testobj.about
End If
Objtotest (i,2) =isobj
Objtotest (i,3) =verobj
Next

Sub Objtest (strobj)
On Error Resume Next
Isobj=false
Verobj= ""
Testobj= ""
Set Testobj=server. CreateObject (Strobj)
If IsObject (testobj) Then
Isobj = True
Verobj = Testobj.version
If verobj= "" or IsNull (verobj) then Verobj=testobj.about
End If
End Sub
%>
<title>object check</title>
<table border= "1" cellpadding= "0" cellspacing= "0" style= "border-collapse:_
Collapse "bordercolor=" #cccccc "width=80%>
&LT;TR align=center><td width=40%> Component name &LT;/TD&GT;&LT;TD width=40%> related information </td></tr>
<%for i=0 to 13%>
<tr>
<td> <%=objtotest (i,0) & "<font color=_
#888888 > "& Objtotest (i,1)%></font></td>
<td>
<%
If not Objtotest (i,2) Then
Response.Write "<font color=red> does not support </font>"
Else
Response.Write "Support," & Left (Objtotest (i,3), 22)
End If%></td>
</tr>
<%next%>
</table>

<form action=<%=filename%> method=post>
<input type=text name= "ClassName" size=40>
<input type=submit value= "OK" >
</FORM>

<%
Dim strclass
strclass = Trim (Request.Form ("classname"))
If strclass <> "" Then
Response.Write "<br> Check results for the components you specified:"
Dim Verobj1
Objtest (strclass)
If not Isobj Then
Response.Write "<br><font color=red> very Sorry, the service _
The "& strclass &" component is not supported by the device! </font> "
Else
If verobj= "" or IsNull (verobj) Then
Verobj1= "Cannot get this component version"
Else
Verobj1= "This component version is:" & Verobj
End If
Response.Write "<br><font class=fonts> Congratulations!" The service _
The "& strclass &" component is supported. "& Verobj1 &" </font> "
End If
End If
%>


If you can run the ASP file, that means you have the Web service for IIS. Since there is IIS, there is no accident that we are going to learn the group today



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.