Blue Theme Orange Theme Green Theme Red Theme
 
Discover the top 5 tips for understanding .NET Interop
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Discover the top 5 tips for understanding .NET Interop
Search :       Advanced Search »
Home » C# Language » Make Your Application with Trial Version

Make Your Application with Trial Version

In this article we see how we assign trial period in our Application.

Page Views : 8654
Downloads : 560
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
Make Your Application with Trial Version.zip
 
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 


Make Your Application with Trial Version

In this article we see how we assign trial period in our Application.

Most of the software has its own trial period. Few have installation time.

Here I describe the simplest way to make our product trial. We build a simple dll & call it from our application.

Features of this dll:

  • If user has no key then it works only for 30 days.
  • When user starts the app it asked if he/she interested to enter a product key or not.
  • If user changes the date then the software will not run until he/she enters a valid product key.

The algorithm is very simple.

  1. First we check is the Product key is provided or not.
  2. If provided then Execute the main application.
  3. Otherwise check, software is blacklisted or not. *
  4. If black listed then asked for valid key if no key then terminate.
  5. If not blacklisted check first time execution or not.
  6. If first time execute then open a simple message & execute main application.
  7. If not, check day duration if less than 30 days, then open a message that it is in trial period, user may enter Product key.
  8. If user chose product key option then check that valid or not. If valid then show a confirm message, else not confirm.
  9. If 30 days over then show expired message & asked for Product key.
  10. If provide valid Product key then open main application, Otherwise terminate application.
     

(*) blacklist: If user changes the system date then this checking marks the software as term blacklist. It has no other meaning. If it mark as blacklist then until providing the valid product Key It will not work.

The Code snippiest is,

In your main Application, add this code to Programm.CS

using SecureApp;

static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            string path = @"Software\Tanmay\Protection";
            Secure scr = new Secure();
            bool logic = scr.Algorithm("tanmay", path);
            if(logic ==true)
                Application.Run(new Form1());
        }

Here all the necessary information will save in Registry.

So you must provide a valid path, which will create this dll.

In this case the password is : tanmay,

Those two things are provided as,

bool logic = scr.Algorithm("tanmay", path);

The main code scr.Algorithm(,) is as follows,

public bool Algorithm(String appPassword, String pass)
        {
            globalPath = pass;
            bool chpass = checkPassword(appPassword);
            if (chpass == true) //execute
                return true;
            else
            {
                bool block = blackListCheck();
                if (block == false)
                {
                    string chinstall = checkfirstDate();
                    if (chinstall == "First")
                    {
                        firstTime();// installation date
                        DialogResult ds = MessageBox.Show("You are using trial Pack! Would you Like to Activate it Now!", "Product key", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (ds == DialogResult.Yes)
                        {
                            Form1 f1 = new Form1(appPassword, globalPath);
                            DialogResult ds1 = f1.ShowDialog();
                            if (ds1 == DialogResult.OK)
                                return true;
                            else
                                return false;
                        }
                        else
                            return true;
                    }
                    else
                    {
                        string status = dayDifPutPresent();
                        if (status == "Error")
                        {
                            blackList();
                            DialogResult ds = MessageBox.Show("Application Can't be loaded, Unauthorized Date Interrupt Occurred! Without activation it can't run! Would you like to activate it?", "Terminate Error-02", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                            if (ds == DialogResult.Yes)
                            {
                                Form1 f1 = new Form1(appPassword, globalPath);
                                DialogResult ds1 = f1.ShowDialog();
                                if (ds1 == DialogResult.OK)
                                    return true;
                                else
                                    return false;
                            }
                            else
                                return false;
                        }
                        else if (status == "Expired")
                        {
                            DialogResult ds = MessageBox.Show("The trial version is now expired! Would you Like to Activate it Now!", "Product key", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (ds == DialogResult.Yes)
                            {
                                Form1 f1 = new Form1(appPassword, globalPath);
                                DialogResult ds1 = f1.ShowDialog();
                                if (ds1 == DialogResult.OK)
                                    return true;
                                else
                                    return false;
                            }
                            else
                                return false;
                        }
                        else // execute with how many day remaining
                        {
                            DialogResult ds = MessageBox.Show("You are using trial Pack, you have " + status + " days left to Activate! Would you Like to Activate it now!", "Product key", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (ds == DialogResult.Yes)
                            {
                                Form1 f1 = new Form1(appPassword, globalPath);
                                DialogResult ds1 = f1.ShowDialog();
                                if (ds1 == DialogResult.OK)
                                    return true;
                                else
                                    return false;
                            }
                            else
                                return true;
                        }
                    }
                }
                else
                {
                    DialogResult ds = MessageBox.Show("Application Can't be loaded, Unauthorized Date Interrupt Occurred! Without activation it can't run! Would you like to activate it?", "Terminate Error-01", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                    if (ds == DialogResult.Yes)
                    {
                        Form1 f1 = new Form1(appPassword, globalPath);
                        DialogResult ds1 = f1.ShowDialog();
                        if (ds1 == DialogResult.OK)
                            return true;
                        else
                            return false;
                    }
                    else
                        return false;
                    //return "BlackList";
                }
            }
        }


 

All other methods are in source code. So download full source code if you want to use it.

Screen Shorts:

When First time it will open,

trial1.JPG

Next time,

trial2.JPG

And few days latter,

trial3.JPG

If user Want to enter Product key then chose Yes Button & the screen will be,

trial4.JPG

If user interrupt in system date the Error Message will like,

trial5.JPG

If trial Version is expired,

trial6.JPG

If enter a Correct Product key,

trial7.JPG

Other wise it looks like,

trial8.JPG

Now in every time, the original application will start first, like the sample,

trial9.JPG

Limitation:

All the information is saved in Registry, so it can be found. You should create a complex path.

As Product key is in main project, for several product key you should build it for several times.

Few Words:

This article just shows a sample or can say an easiest way to make trial product.

It is built in Visual Studio 2010 & framework 3.5.

That's it.

Hope, it will help you!

Thank you!

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Tanmay Sarkar
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the Top 5 .NET Memory Management Fundamentals
To write the best .NET code, you need to know exactly how the .NET framework really manages memory. Ricky Leeks presents the Top 5 fundamental facts of .NET memory management. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Team Foundation Server Hosting
Become a Sponsor
 Comments
Nice try but too simple by Vijay On September 5, 2010
No matter what complex path you try to create (as you have suggested in limitations), it can be found out with RegMon.

'As Product key is in main project, for several product key you should build it for several times.' - does that mean for 1000 copies of my software, I need 1000 builds? How does it scale up?
Reply | Email | Modify 
Re: Nice try but too simple by Tanmay On September 8, 2010
You can make combination of keys. This is a simple article to describe a sample procedure.

You can find something here,
http://www.c-sharpcorner.com/UploadFile/tanmayit08/3239/Default.aspx

Thanks for your comment.

Thank you!
Reply | Email | Modify 
Re: Nice try but too simple by dhanda On December 27, 2010
can be Store information registry in encrypted form
Reply | Email | Modify 
Combination of Keys by Tanmay On September 8, 2010
A building always build step by step. If any body want to build keys for several users then there is a simple article

http://www.c-sharpcorner.com/UploadFile/tanmayit08/3239/Default.aspx

Thank you!
Reply | Email | Modify 
Thank You by Suyel On March 20, 2011
The above example is very interesting and helpful too... Can u plz explain it in brief ??
Reply | Email | Modify 
Re: Thank You by Tanmay On March 21, 2011
Thanks Suyel, what type of explanation you need!
Reply | Email | Modify 
6 Months Free & No Setup Fees ASP.NET Hosting!
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.