Use components to protect your ASP code (RPM)

Source: Internet
Author: User
Tags connect new features visual studio
Use components to protect your ASP code


Source:

Body:

Before we talked a lot about the security of Open database connection, now I put forward a kind of thinking
Use an ActiveX DLL to protect your code. (You don't have to worry about using shared encryption software,
More importantly, you can top the encryption method, enjoy the "everything in control" feeling.
At the same time, in order for everyone to do their own work to make their own components. )

ActiveX DLLs is a compiled machine code that cannot be compiled without the source project file.
This technology makes it possible for developers to develop public automation programs and publish them as shareware versions of programs
This technology can be seen in some of the components that you sell in chinaasp.
If you want to protect the security of some code in your ASP, for example you don't want others to see what you are using to connect to
database, or do not want to let others see how some of your more important functions are done, or some important
Process (Cakk can refer to), you can continue to develop your own components, this is a DLL file, that is, others get
This DLL file, 1:30 will also not be able to get the important information you want to protect. And the components that you developed yourself
brings a stream of new features to your program.

Here's a very common example of how to open a database in a confidential way.
The simple example is to display the contents of a field in a database in a Drop-down box.
The whole process is as follows:
1. Create a new VB6 ActiveX DLL project
2. In the Properties window, name your library module and project file. Example is the Keiths_lookup project name and the lookup module name.
This name is the name of the DLL function you refer to in ASP (the object name in ASP is Keiths_lookup.lookup).
3. Save the Project and library module with the same name (of course, the suffix is not able to be the same OH).
4. Select References from the Project menu in VB6. Then select the Microsoft ActiveX Data Objects 2.0 library, Microsoft
ActiveX Data Objects Recordset 2.0 library.
The code for the file is as follows:
Public Function Html_combo (ComboName As String, Lookup_field as String) as String
Dim outstring as String
Dim Conn as ADODB. Connection
Dim rst as ADODB. Recordset
Dim SqlString as String

Set conn = CreateObject ("ADODB. Connection ")
Set rst = CreateObject ("ADODB.") Recordset ")
' The field names in these databases are just for this example, and you can modify the code to suit your needs.
SqlString = "SELECT [Lookup_description],[lookup_key] From _
[Lookup_table] WHERE [Lookup_field] = ' "& Lookup_field &" "

' Here you can enter your username and password to connect to the database, now even if the client sees the ASP source code
' He's not going to know what password you're using, huh?
Conn. Open "dsn=sumnet; uid=; Pwd=.; "
Rst. Open SqlString, Conn, 3, 3

If not rst. EOF Then
Rst. MoveFirst
outstring = "<select name= '" & ComboName & "' >"
Do as not rst. Eof
outstring = outstring & "<option value= '" & rst. Fields ("Lookup_key") & "' >" & _
Rst. Fields ("Lookup_description") & "</Option>"
Rst. MoveNext
Loop
End If

outstring = outstring & "</Select>"
Html_combo = outstring

Rst. Close
Conn. Close
End Function
The end of the code, OH, basically no technical difficulties, now save your project and start compiling work.
1. Open the Package Deployment Wizard program with Visual Studio 6.
2. Select the ActiveX project file you just created.
3. Select Package
4. Select the script you want to package or use the default script
5. Select Standard Installation
6. Select a directory to place your installation files
7. Select Single Cab.
8. All other defaults, and then click Next
9. Now when the installer is finished, take it to your IIS server and install it.

Here's how to invoke your own code for this component:
<%@ language= "VBSCRIPT"%>
<%
Set look = Server.CreateObject ("Keiths_lookup.lookup")
%>
<HTML>
<BODY>
<%=look.html_combo ("state", "States")%>
<BR>
<%=look.html_combo ("Position", "positions")%>


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.