To effectively protect software, it is necessary to implement Asp.net Program . The idea of registering in this article is to obtain the ID number based on some machine codes on the server. The ID number is encrypted. Algorithm Encrypted to form a serial number. During registration, the user notifies the software equity Owner of the ID number, and the software equity Owner informs the user of the serial number. When a user registers based on the serial number, the serial number is saved in the database. Perform a registration check in the Asp.net program. Compare the serial number generated based on the machine code of the probe server with the serial number in the database. If the two are consistent, the registration program is used. Otherwise, the registration program is not used.
To achieve this function, this article provides a complete solution, which consists of the following files.
Reg_forcool.cs contains various functions that implement the registration function. It is used as an encapsulation reference and stored in the bin folder.
Reg. aspx and Reg. aspx. cs. The user requests a serial number from the software equity Owner for registration based on the ID number provided by the program.
Getsn. aspx and getsn. aspx. CS generate the serial number program and generate the serial number based on the user ID. This program is not provided to users and is saved by the software equity Owner.
Check_reg.aspx and check_reg.aspx.cs check whether the program is registered. This program can be transplanted to important pages that are required by other users.
// The following file: reg_forcool.csContains various functions that implement the registration function
// As an encapsulation reference and saved in the bin folder
Using system;
Using system. Data;
Using system. configuration;
Using system. collections;
Using system. Web;
Using system. Web. Security;
Using system. Collections. Generic;
Using system. text;
Using system. Management; // you need to add reference system. Management in Solution Explorer
Using system. Security; // you need to add reference system. Security in Solution Explorer
Using system. Security. cryptography;
Using system. IO;
Namespace reg_forcool_namespace
{
Public class reg_forcool_class
{
/// <Summary>
/// Obtain the MAC address of the NIC
/// </Summary>
/// <Returns> </returns>
Public String getnetcardmacaddress ()
{
Managementclass MC;
Managementobjectcollecti On MOC;
MC = new managementclass ("win32_networkadapter=at Ion ");
MoC = mc. getinstances ();
String STR = "";
Foreach (managementobject Mo in MoC)
{
If (bool) Mo ["ipenabled"] = true)
STR = Mo ["macaddress"]. tostring ();
}
STR = Str. Replace (":","");
Return STR;
}
//