Click here to Skip to main content
13,249,813 members (84,709 online)
Click here to Skip to main content
Add your own
alternative version


17 bookmarked
Posted 26 Jul 2007

Password Manager and Web Form Filler

, 26 Jul 2007
Rate this:
Please Sign up or sign in to vote.
How to build a simple user account manager which can automatically login to websites.

Screenshot - enigma.gif


Lately, I've been travelling a lot and I have to use my email and other accounts via web forms. To keep track of all accounts, I keep a little black book with me, but still need to enter the data every time I log in. I searched the web for password fillers and thought they were all so heavy-weight and packed with lots of features while I only needed a password manager that could send keystrokes to a WebForm. So, I did what every programmer does in that case: built it myself.

You can start Enigma as a normal Windows application, or with a command-line parameter which starts an account and closes Enigma.

  • enigma.exe
  • enigma.exe "testaccount"

Using the Code

This project is pretty straightforward. It does:

  • Reads an XML file with account info;
  • Fills a listview with this data;
  • On a double-click, starts IE and sends keystrokes with your account info to it;
  • Accepts a command line argument.

First, let's get the account info from enigma.xml. We declare this function:

public static object DeSerialize(string fileName, Type type)
    using (FileStream input = new FileStream(fileName, FileMode.Open))
        XmlSerializer sr = new XmlSerializer(type);
        object o = sr.Deserialize(input);
        return o;

And, call it with:

accountmanager = (AccountManager)Serializer.DeSerialize(_XMLPath, 

This is a great way to deserialize (and serialize) any object in your project. As long as you use serializable types, you can store and retrieve your complete application status in it.

The list of accounts is displayed in a listview. If an account is double-clicked, its info is retrieved from the account collection. In .NET 2.0, I used to loop through a collection to find an item. In this project, I've used some LINQ to do that. It was a perfect way to use LINQ for the first time.

public Account GetAccount(string accountname)
    return accountlist.First(x => x.Name.ToLower() == accountname.ToLower());

IE is started like this:

Process browser = Process.Start(@"C:\Program Files\Internet Explorer\iexplore.exe", 

And two timers are started:

timerStartApp.Enabled = true;
timerCloseEnigma.Enabled = true;

timerStartApp starts filling the web form, and timerCloseEnigma closes Enigma if it's started as an app with command-line arguments. On timerStartApp_Tick, the login info is parsed to an array of strings. These array items hold the data for a single web form field. After sending an array item, it's followed by a TAB, and at the end, with an ENTER.

void timerStartApp_Tick(object sender, EventArgs e)
    timerStartApp.Enabled = false;
    string[] tabs = accountmanager.selectedaccount.KeyStrokes.Split('|');
    for (int i = 0; i < tabs.Length; i++)
        for (int j = 0; j < tabs[i].Length; j++)
        if (i < tabs.Length - 1)

And, that's pretty much all of it. You can send a complete string to SendKeys.Send(), but I've experienced some problems with that method. So I chose to loop through the string and send the characters one by one.

Points of Interest

I stopped coding once it worked for me, but I guess there are a few issues to be worked out if you want to use it:

  • It currently only works with IE (but that's easily helped if you change the line "C:\Program Files\Internet Explorer\iexplore.exe").
  • It sometimes sends multiple keystrokes where it only should send one. If you know a solution to that problem, please let me know at
  • The target web form needs to have the focus on the first form field.
  • Account info is stored unencrypted

Be careful with your account info! If a new application starts 'while using Enigma' and gets the focus, Enigma will send your account info to it. This can be a problem if that application is a chat program like Messenger :-)

Orcas version

The demo project failed when I updated to Orcas Beta 2. I had to recompile the executable, and then it worked.


  • 26 July 2007: First version.


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


About the Author

Web Developer
Netherlands Netherlands
Loek van den Ouweland is a freelance Web Developer from The Netherlands.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171114.1 | Last Updated 26 Jul 2007
Article Copyright 2007 by Toverstudio
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid