Solve the problem of connection-like encapsulation DLL in ASP

Source: Internet
Author: User
Tags end string variable strong password

ASP code Confidentiality has been a headache, there is no very good solution, nothing more than VB compiled into a DLL, but the workload is really too large, so has been struggling to find another way, this article introduces the solution to the ASP in the connection of the problem of the package of the article topic.

At noon, a sudden inspiration, "Why not try to use encrypted database?", by setting a strong password on the database, and then using VB to encapsulate the connection, write the password information in the DLL, and then use the ASP to create the component method to call, even if someone else took my code, You can't change the database!

So, began a step by step both painful and stimulating journey. VB used three or four years ago, and the vegetables are no longer vegetables, in order to find ideas, on the internet search, Baidu sometimes very harmful, search a lot of fraught out, especially that VB program only put a connection string, and then use ASP to create components, take out the string, and then connect the train of thought, no meaning, A respose.write connection string comes out.

to achieve the purpose of encrypting the database, the link string is absolutely not displayed, so I refer to the tornado written in the "Use Component Encapsulation database operation (ii)" method, set a conn global variable, and then open the database function returned only true and false. A more important point is to encapsulate the RS Execute method and write it into a DLL, as follows:

1. Open VB, create an ActiveX DLL project, the project name is called MyConn, class module is Dbconn, and then write the following code:

Option Explicit
Dim RP as Response
Dim RQ as Request
Dim AP as Application
Dim SR as Server
Dim SN as session
Dim Conn as ADODB. Connection ' Create conn global variable
Dim RS as ADODB. Recordset ' Create a full Dodge variable Rs

Public Sub OnStartPage (Myscriptingcontext as ScriptingContext)
Set RP = Myscriptingcontext.response
Set RQ = Myscriptingcontext.request
Set sr = Myscriptingcontext.server
Set ap = myscriptingcontext.application
Set sn = myscriptingcontext.session

End Sub

Public Sub OnEndPage ()
Set RP = Nothing
Set RQ = Nothing
Set sr = Nothing
Set ap = Nothing
Set sn = Nothing
End Sub

Total 2 page: previous 1 [2] Next page



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.