Wednesday, March 31, 2010

.Net Obfuscator for securing your source code

Hi Everyone,

The first priority and biggest challenge for any software developer is, How to secure application from re-engineering?

We know that the languages which are Interpreted can easily be re-engineered via Decompiler.
Even .Jar, .Class, .dll and .exe files can easily be decompiled which are created by Java and .Net.

What is Obfuscation?
Is the process of encrypting your .Net code so that it cannot be easily re-engineered.
It is language neutral technology even you can obfuscate java code too.
It is mainly used in managed languages because they can be re-engineered.

Then how to protect???

You can use Obfuscator for that. It just mangle your method, properties, classes and variables.
It means it change the name suppose your class name is Test, after obfuscator it may become ?dsghd.

So it cannot be easily understandable after decompilation.

Here i am putting some tools for protecting you code.

Wednesday, February 17, 2010

Convert Jar to Exe and Secure Java Application

Hello Friends,

Hope you will see my previous post regarding the same.


first of all Thanks for mailing me and your doubts.
Many people ask me question which one is best,secure and easy among them.

Actually many of them are developed on java itself.
So some time they just change the name of jar file to exe and it looks that we made it,
But originally you can extract it by changing its name again.

Best is use some commercial tool or Use tool which actually convert it into Win32 exe's.
I tried Excelsior that is commercial (think made in java) and jstart32 (Made in delphi) with
GNU license are tool which originally created a Win32.exe.

go and try...

Hope now you will feal secure.
Ask if any query or comment if you like.

Saturday, January 30, 2010

Accessing Master Page Properties from Child Page

 Hello Friends.

Today hot topic is that how to access properties from MasterPage into content page.
I think there is several methods you can access those properties or variable.

1. By Master property of content page
2. By interface
3. By Including a MasterPage Directive in Pages.

So here i am providing you some code stuff for the same.
1. Access Master Page properties and Method by Master property of Page.

Master Page Code

     public string ButtonText
      {
           get { return this.Button1.Text; }
           set { this.Button1.Text = value; }
      }

Child Page Code

        //Master page is the name of master page file
        MasterPage mast = this.Master as MasterPage;
        if (mast != null)
        {
            mast.ButtonText = "New Text";
        }

-----------------------------------------------------------------------------------
2. Access Master Page properties and Via Interface.
see here
http://dotnetbyexample.blogspot.com/2007/10/right-way-of-accessing-master-page.html

Wednesday, January 27, 2010

Setting the wallpaper from C# code

Hi Friends,

What if you want to change the wallpaper of your desktop from C#.Net. for that you have to use Unmanaged code.

You have to import and pass parameters to function from User32 dll.
Here I am posting the code for performing the same.

[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int SystemParametersInfo(int Action, int Param, string lParam, int WinIni);
call the function and pass some useful parameters like ...
Bitmap bmp = new Bitmap(Image.FromFile(@"C:\mytest.jpg"));
bmp.Save("MyFile.Bmp", ImageFormat.Bmp);
SystemParametersInfo(20, 0, "pic.bmp", 0x1);

The first parameter 20 is for Wallpaper
Third parameter is your file path as String.
Last is Update parameter keep it 0X1, 0X01 | 0X02 ..


Note:- Here you see that I am converting the jpeg file into bmp file. Because it state that image should be 24 bits, so keep in mind the change of file else no effect of this function.




Wednesday, January 20, 2010

Handling Null value in case of value type.

Hello friends,

As we can check for null values in case of Reference type.
What if want to do the same with value type.
Here the new feature of .net do it for you.

public int? x;
public int? X
{
get { return x; }
}

Now you can check
if( X != null) or if ( X == null)

Note:- Needed to be type cast to (int) where need int value.
Use:- Very usefull suppose you declared any field as integer in database table.
And you forget to declared default value as 0 (zero).
Then whenever you query to database you get a null value so it can be used for checking that.