Click here to Skip to main content
Licence CPOL
First Posted 16 Sep 2011
Views 5,313
Downloads 0
Bookmarked 1 time

Code encryption at MVC2

By SadequeSharif | 16 Sep 2011 | Technical Blog
It’s been on my mind that, to encrypt all the major code of MVC project. Last night I did it. Now it’s time to share it with you. Let’s start…. Step 01. Create a new asp.net mvc2 project and named it TestProject. Step 02. Now you need to create a class library project. For that,  [...]
   0.00 (0 votes)
 
A Technical Blog article. View original blog here.[^]

It's been on my mind that, to encrypt all the major code of MVC project. Last night I did it. Now it’s time to share it with you. Let’s start.

Step 01. Create a new asp.net mvc2 project and named it TestProject.

Step 02. Now you need to create a class library project. For that,  select File > Add > New Project. Add New Project window will appear. Select Class Library as project type and named the project as Test.EncryptCode. Solution Explorer window will be like as below picture.

01

Delete the Class1.cs file from Test.EncryptCode project.

Step 03. Now add all the references to Test.EncryptCode project, those references are exist in TestProject project.

Step 04. Select the AccountModels.cs file from TestProject > Models. Drag that file to Test.EncryptCode project. Delete the AccountModels.cs file from TestProject project.  Now Solution Explorer window will be like as below picture.

02

Step 04. Now change the AccountsModels namespace as Test.EncryptCode. It will look like below picture.

03

Now build the Test.EncryptCode project. Add the Test.EncryptCode project as reference into TestProject project. We can add it by using project > add reference menu. A Reference window will appear and select the Test.EncryptCode from project tab

04

Open AccountController.cs file and change the TestProject.Models namespace to Test.EncryptCode.

Now open the ChangePassword.aspx, LogOn.aspx and Register.aspx file. just change the TestProject.Models to Test.EncryptCode in inherits property. The code will be like as below.

ChangePassword.aspx

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Test.EncryptCode.ChangePasswordModel>" %>

Register.aspx

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Test.EncryptCode.RegisterModel>" %>

LogOn.aspx

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Test.EncryptCode.LogOnModel>" %>

Now run the project and see it works!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

SadequeSharif

Software Developer
KDS Garment Industries limited
Bangladesh Bangladesh

Member

Follow on Twitter Follow on Twitter
Trying hard to do programming in simple way.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120222.1 | Last Updated 16 Sep 2011
Article Copyright 2011 by SadequeSharif
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid