Saturday, July 3, 2010

C#: Hide Password in Console.

Hie friends, consider a situation where you are developing a console login application.In this application user enters his Username and password.
Username: Admin 
Password: ******* (Hidden Pasword)
Above is the example of secure login. But if you are developing this application in c# console, C# doesn't have such method which could hide you password.
Here is the code through which you can ask user to input a string secretly.
Snippet 1:

private string GetPassword()
        {
            string Password = "";
            ConsoleKeyInfo MyKey = Console.ReadKey(true);
            Console.Write("*");
            while (!(MyKey.Key == ConsoleKey.Enter))
            {
                Password += MyKey.KeyChar;
                MyKey = Console.ReadKey(true);
                if (MyKey.Key == ConsoleKey.Backspace)
                {
                    if(!string.IsNullOrEmpty(Password))
                    {
                        Console.Write("\b");
                        Password.Substring(0, Password.Length - 1);
                    }
                }
                if (MyKey.Key != ConsoleKey.Backspace && MyKey.Key != ConsoleKey.Enter)
                {
                    Console.Write("*");
                }
            }
            return Password;
        } 
 
How to use in program?
 
Snippet:2

public void UserLogin()
        {
            string uname,pwd;
            Console.Write("Username: ");
            uname = Console.ReadLine();
            Console.Write("Password: ");
            pwd = GetPassword();
        } 
Hope this could help you.

Thanks!!

Saturday, April 3, 2010

How to fix Task Manager Error!

Hello Friends!
Sometimes when you run task manager, you get an error message "Task Manager has been disabled by your administrator". This error may occur due to a virus.
No need to worry! Here I'll tell you how to fix this error.You need to made some changes in your registry in a few steps.
Step 1: Open Run>>Type "regedit", then click OK.










Step 2: Locate the following key  "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System".

Step 3: On the right pane you'll find a value named as "DisableTaskMgr". Either Delete this Value or double Click on it and change the value to "00000000".

Step 4: You're done. Your Task Manager has been Enabled by you.

Its a long & boring process, so I've created a user friendly program that fixes your task manager in seconds.
You can download this program here.
Program is in progress & to be uploaded soon.

I hope this will help you.:)
Thanks!!

Monday, March 22, 2010

How to Rename Recyle Bin?

Hey Friends,
Many people are very curious about how to rename their Recycle Bin. Microsoft Windows doesn't allow you to do so.Here I'll tell you how to rename it.You can rename it by tweaking a registry value.Here is the path of that subkey: 



HKEY_CLASSES_ROOT >> CLSID >> {645FF040-5081-101B-9F08-00AA002F954E}.
This key contains attributes Recycle Bin.Under this subkey, there is a String Value named as"LocalizedString".You can rename you recycle bin by changing it's Value.

It's a long & boring process but don't worry, I've created a Simple User Friendly Program which can Rename your Recycle Bin In seconds.You can Download it here.


view Screen Shot of Rename Recycle Bin.


Remember all my applications are platform independent but need .net FrameWork. So you can Download it too by Clicking here.





Waiting for your feedback. ;)

[I'm working on registries and developing an application which can easily make any changes in your registry without harming your OS.]